Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Pull request
"on":
pull_request:
jobs:
lint:
runs-on: ubuntu-22.04
permissions: {}
strategy:
fail-fast: false
matrix:
include:
# NOTE(upgrade): Keep these in sync with Kayobe's supported Ansible and Python versions (see release notes).
- ansible: "2.16"
python: "3.12"
name: Ansible ${{ matrix.ansible }} lint with Python ${{ matrix.python }}
steps:
- name: GitHub Checkout 🛎
uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }} 🐍
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install dependencies 📦
run: |
python -m pip install --upgrade pip
pip install ansible-core==${{ matrix.ansible }}.* ansible-lint

- name: Linting code 🧪
run: |
ansible-lint -v --force-color
102 changes: 52 additions & 50 deletions ansible/generate-magnum-capi-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,59 @@
vars:
root_dir: ../
tasks:

- name: Check that required variables are defined
assert:
that:
- magnum_default_master_flavor_name is defined
- magnum_default_worker_flavor_name is defined
- magnum_external_net_name is defined
- magnum_loadbalancer_provider is defined

- name: Fetch capi-helm-charts release information
ansible.builtin.uri:
url: https://api.github.com/repos/azimuth-cloud/capi-helm-charts/releases/latest
register: capi_helm_chart_release_data

- name: Fetch dependencies.json for capi-helm-charts release
ansible.builtin.uri:
url: https://raw.githubusercontent.com/azimuth-cloud/capi-helm-charts/{{ capi_helm_chart_release_data.json.tag_name }}/dependencies.json
register: dependencies_response

- name: Ensure wget packages is installed
become: true
package:
name: wget
state: present

- name: Fetch manifest.json for capi-helm-charts images
- name: Check that required variables are defined
ansible.builtin.assert:
that:
- magnum_default_master_flavor_name is defined
- magnum_default_worker_flavor_name is defined
- magnum_external_net_name is defined
- magnum_loadbalancer_provider is defined

- name: Fetch capi-helm-charts release information
ansible.builtin.uri:
url: https://api.github.com/repos/azimuth-cloud/capi-helm-charts/releases/latest
register: capi_helm_chart_release_data

- name: Fetch dependencies.json for capi-helm-charts release
ansible.builtin.uri:
url: https://raw.githubusercontent.com/azimuth-cloud/capi-helm-charts/{{ capi_helm_chart_release_data.json.tag_name }}/dependencies.json
register: dependencies_response

- name: Ensure wget packages is installed
become: true
ansible.builtin.package:
name: wget
state: present

- name: Fetch manifest.json for capi-helm-charts images # noqa command-instead-of-module
# ansible.builtin.uri:
# url: https://raw.githubusercontent.com/azimuth-cloud/azimuth-images/{{ dependencies_response.json['azimuth-images'] }}/manifest.json
# Above URL returns 404 even though similar URL for capi-helm-charts repo works fine
# Not sure why but fall back to wget + JSON parsing for now.
shell: "wget -O - https://github.com/azimuth-cloud/azimuth-images/releases/download/{{ dependencies_response.json['azimuth-images'] }}/manifest.json"
register: manifest_response
changed_when: false

- name: Parse JSON response
set_fact:
new_template_data: "{{ manifest_response.stdout | from_json | dict2items | selectattr('key', 'match', 'kubernetes*') | list }}"

- name: Ensure output dir exists
ansible.builtin.file:
path: "{{ [root_dir, 'generated-magnum-snippets', now(utc=true,fmt='%Y-%m-%d-T%H-%M-%S')] | path_join }}"
state: directory
mode: '0755'
register: output_dir

- name: Write new image config to file
template:
src: "magnum-capi-images.j2"
dest: "{{ output_dir.path }}/images.yml"

- name: Write new cluster template config to file
template:
src: "magnum-capi-templates.j2"
dest: "{{ output_dir.path }}/templates.yml"
ansible.builtin.command: >-
wget -O - https://github.com/azimuth-cloud/azimuth-images/releases/download/{{ dependencies_response.json['azimuth-images'] }}/manifest.json
register: manifest_response
changed_when: false

- name: Parse JSON response
ansible.builtin.set_fact:
new_template_data: "{{ manifest_response.stdout | from_json | dict2items | selectattr('key', 'match', 'kubernetes*') | list }}"

- name: Ensure output dir exists
ansible.builtin.file:
path: "{{ [root_dir, 'generated-magnum-snippets', now(utc=true, fmt='%Y-%m-%d-T%H-%M-%S')] | path_join }}"
state: directory
mode: "0755"
register: output_dir

- name: Write new image config to file
ansible.builtin.template:
src: "magnum-capi-images.j2"
dest: "{{ output_dir.path }}/images.yml"
mode: "0644"

- name: Write new cluster template config to file
ansible.builtin.template:
src: "magnum-capi-templates.j2"
dest: "{{ output_dir.path }}/templates.yml"
mode: "0644"
17 changes: 9 additions & 8 deletions ansible/openstack.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
# Top level playbook that includes all others.
- import_playbook: openstack-project.yml
- import_playbook: openstack-networks.yml
- import_playbook: openstack-flavors.yml
- import_playbook: openstack-images.yml
- import_playbook: openstack-host-aggregates.yml
- import_playbook: openstack-volume-types.yml
- import_playbook: openstack-container-clusters.yml
- import_playbook: openstack-ratings.yml

- import_playbook: openstack-project.yml # noqa name[play]
- import_playbook: openstack-networks.yml # noqa name[play]
- import_playbook: openstack-flavors.yml # noqa name[play]
- import_playbook: openstack-images.yml # noqa name[play]
- import_playbook: openstack-host-aggregates.yml # noqa name[play]
- import_playbook: openstack-volume-types.yml # noqa name[play]
- import_playbook: openstack-container-clusters.yml # noqa name[play]
- import_playbook: openstack-ratings.yml # noqa name[play]
58 changes: 28 additions & 30 deletions etc/openstack-config/openstack-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,64 @@

# List of OpenStack domains. Format is as required by the stackhpc.os-projects
# role.
#openstack_domains:
# openstack_domains:

# List of OpenStack projects. Format is as required by the stackhpc.os-projects
# role.
#openstack_projects:
# openstack_projects:

###############################################################################
# Configuration of networks, subnets and routers.

# List of networks in the openstack system. Format is as required by the
# stackhpc.os-networks role.
#openstack_networks:
# openstack_networks:

# List of routers in the openstack project. Format is as required by the
# stackhpc.os-networks role.
#openstack_routers:
# openstack_routers:

# List of security groups in the openstack project.
# Format is as required by the stackhpc.os-networks role.
#openstack_security_groups:
# openstack_security_groups:

# List of RBAC definitions in the openstack projct. Format is as required by the
# stackhpc.os-networks role.
#openstack_networks_rbac:
# openstack_networks_rbac:

###############################################################################
# Configuration of nova flavors.

# List of nova flavors in the openstack project. Format is as required by the
# stackhpc.os-flavors role.
#openstack_flavors:
# openstack_flavors:

###############################################################################
# Configuration of nova host aggregates.

# List of nova host aggregates. Format is as required by the
# stackhpc.os_host_aggregates role.
#openstack_host_aggregates:
# openstack_host_aggregates:

###############################################################################
# Configuration of Glance software images.

# List of Glance images. Format is as required by the stackhpc.os-images role.
#openstack_images:
# openstack_images:

# List of Diskimage Builder (DIB) elements paths to include in image builds.
#openstack_image_elements:
# openstack_image_elements:

# List of Diskimage Builder (DIB) elements Git repositories to use in image
# builds.
#openstack_image_git_elements:
# openstack_image_git_elements:

###############################################################################
# Configuration of Magnum container clusters.

# List of magnum cluster templates. Format is as required by the
# stackhpc.os-container-clusters role.
#openstack_container_clusters_templates:
# openstack_container_clusters_templates:

###############################################################################
# Configuration variables for generating new Magnum cluster template config.
Expand Down Expand Up @@ -100,35 +100,33 @@
# Configuration variables for a CloudKitty ratings service deployment.

# # ### ####### ##### IN ORDER TO SUCCESSFULLY DEPLOY CLOUDKITTY
# # # # # # # 'cloudkitty.conf' & 'metrics.yml' MUST BE
# # # # # # # 'cloudkitty.conf' & 'metrics.yml' MUST BE
# # # # # # ### PROVIDED ALONGSIDE THE FOLLOWING CONFIG.
# # # # # # # MORE INFO CAN BE FOUND IN THE README.md
# # ### # ##### 'stackhpc-kayobe-config' DOCS.


# A list where each item is a dictionary mapping the associated fields,
# A list where each item is a dictionary mapping the associated fields,
# with the 'mappings' field also being a list of dictionaries. Example
# of the mappings and their fields can be found below, however for more
# information please refer to the stackhpc.openstack.os_ratings role docs.
#
#openstack_ratings_hashmap_field_mappings:
# - service: SERVICE_NAME
# name: FIELD_NAME
# mappings:
# - value: MAPPING_VALUE
# cost: MAPPING_COST
# type: MAPPING_TYPE
# group: MAPPING_GROUP <---THIS IS OPTIONAL---
# openstack_ratings_hashmap_field_mappings:
# - service: SERVICE_NAME
# name: FIELD_NAME
# mappings:
# - value: MAPPING_VALUE
# cost: MAPPING_COST
# type: MAPPING_TYPE
# group: MAPPING_GROUP <---THIS IS OPTIONAL---

# Much like the field mappings above, the service mappings are a list of
# dictionaries, however these are not associated with a field.
#
#openstack_ratings_hashmap_service_mappings:
# - service: SERVICE_NAME
# cost: MAPPING_COST
# type: MAPPING_TYPE
# group: MAPPING_GROUP <---THIS IS OPTIONAL---
# openstack_ratings_hashmap_service_mappings:
# - service: SERVICE_NAME
# cost: MAPPING_COST
# type: MAPPING_TYPE
# group: MAPPING_GROUP <---THIS IS OPTIONAL---

###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
workaround_ansible_issue_8743: true
2 changes: 1 addition & 1 deletion examples/container-clusters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ openstack_container_clusters_templates:

# Kubernetes magnum cluster template.
openstack_container_clusters_template_k8s_fedora_coreos:
labels: "heat_container_agent_tag=ussuri-stable-1,kube_tag=v1.18.9,cloud_provider_tag=v1.18.2,monitoring_enabled=true,auto_scaling_enabled=true,auto_healing_enabled=true,auto_healing_controller=magnum-auto-healer,magnum_auto_healer_tag=latest,master_lb_floating_ip_enabled=true,cinder_csi_enabled=true,ingress_controller=octavia"
labels: "heat_container_agent_tag=ussuri-stable-1,kube_tag=v1.18.9,cloud_provider_tag=v1.18.2,monitoring_enabled=true,auto_scaling_enabled=true,auto_healing_enabled=true,auto_healing_controller=magnum-auto-healer,magnum_auto_healer_tag=latest,master_lb_floating_ip_enabled=true,cinder_csi_enabled=true,ingress_controller=octavia" # noqa yaml[line-length]
external-network: "external"
master-flavor: "m1.medium"
flavor: "m1.medium"
Expand Down
8 changes: 4 additions & 4 deletions examples/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ openstack_image_centos_stream8:
- "vm"
- "grub2"
- "stable-interface-names"
is_public: True
is_public: true
env:
YUM: dnf
DIB_RELEASE: "8-stream"
Expand All @@ -55,7 +55,7 @@ openstack_image_cirros_0_6_0:
type: qcow2
image_url: "https://github.com/cirros-dev/cirros/releases/download/0.6.0/cirros-0.6.0-x86_64-disk.img"
checksum: "md5:f4027b89e99e238184e13089a3155b74"
is_public: True
is_public: true
properties:
os_type: "linux"
os_distro: "cirros"
Expand All @@ -78,7 +78,7 @@ openstack_image_rocky8:
- "grub2"
- "stable-interface-names"
- "openssh-server"
is_public: True
is_public: true
packages:
- "bash-completion"
- "vim-enhanced"
Expand All @@ -101,7 +101,7 @@ openstack_image_rocky8:
openstack_image_ubuntu_focal:
name: "Ubuntu-20.04"
type: raw
is_public: True
is_public: true
elements:
# Required for UEFI mode:
- "block-device-efi"
Expand Down
21 changes: 10 additions & 11 deletions examples/ratings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@
# Configuration of CloudKitty for openstack.

# Example configuration for registering CloudKitty fields.
# Included is mapping for various different compute flavors &
# a service mapping based on the stored image size in Glance.
# Included is mapping for various different compute flavors &
# a service mapping based on the stored image size in Glance.

openstack_ratings_hashmap_field_mappings:
- service: instance
name: flavor_id
mappings:
- value: '1' #tiny compute flavour with an OpenStack flavor ID of 1
- value: "1" # tiny compute flavour with an OpenStack flavor ID of 1
cost: 1.0
group: instance_uptime_flavor_id
type: flat
- value: '2' #small compute flavour with an OpenStack flavor ID of 2
- value: "2" # small compute flavour with an OpenStack flavor ID of 2
cost: 2.0
group: instance_uptime_flavor_id
type: flat
- value: '3' #medium compute flavour with an OpenStack flavor ID of 3
- value: "3" # medium compute flavour with an OpenStack flavor ID of 3
cost: 3.0
group: instance_uptime_flavor_id
type: flat
- value: '4' #large compute flavour with an OpenStack flavor ID of 4
- value: "4" # large compute flavour with an OpenStack flavor ID of 4
cost: 4.0
group: instance_uptime_flavor_id
type: flat
- value: '5' #xlarge compute flavour with an OpenStack flavor ID of 5
- value: "5" # xlarge compute flavour with an OpenStack flavor ID of 5
cost: 5.0
group: instance_uptime_flavor_id
type: flat
- value: '6' #tiny 2 compute flavour with an OpenStack flavor ID of 6
- value: "6" # tiny 2 compute flavour with an OpenStack flavor ID of 6
cost: 2.0
group: instance_uptime_flavor_id
type: flat
Expand All @@ -42,8 +42,7 @@ openstack_ratings_hashmap_service_mappings:
type: flat

# # ### ####### ##### THIS CONFIGURATION FILE ONLY WORKS IF
# # # # # # # 'cloudkitty.conf' & 'metrics.yml' ARE
# # # # # # # 'cloudkitty.conf' & 'metrics.yml' ARE
# # # # # # ### CONFIGURED CORRECTLY. MORE INFO CAN
# # # # # # # BE FOUND IN THE 'stackhpc-kayobe-config'
# # # # # # # BE FOUND IN THE 'stackhpc-kayobe-config'
# # ### # ##### DOCS.