Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0fa6619
Add Cloudkitty role variables definition to openstack-config.
MaxBed4d Apr 5, 2024
05a6443
Cloudkitty.yml example file.
MaxBed4d Apr 8, 2024
375183b
Added ratings role config and example. Changed requirements.
MaxBed4d Apr 8, 2024
5c95e93
Configure some cloudkitty settings.
MaxBed4d Apr 9, 2024
da06a05
Add type to GitHub requirements.
MaxBed4d Apr 9, 2024
d4a1650
Amend group variable default.
MaxBed4d Apr 9, 2024
15c130c
Fix Ansible Galaxy instructions
MoteHue Apr 9, 2024
0dac19c
Change cloudkitty venv to point to openstack_venv.
MaxBed4d Apr 9, 2024
f874110
Merge pull request #24 from stackhpc/fix-readme
markgoddard Apr 10, 2024
f95b0f8
Working Cloudkitty config.
MaxBed4d Apr 10, 2024
97f6f05
Updated and tidied config for Cloudkitty configuration role.
MaxBed4d Apr 10, 2024
5f39695
Tidy up group_vars
MaxBed4d Apr 10, 2024
71c5913
Pointing to the now merged CloudKitty Ansible role.
MaxBed4d Apr 10, 2024
6cbf191
Merge pull request #25 from stackhpc/cloudkitty-role-config
markgoddard Apr 11, 2024
cea418a
Allow extra labels in generated cluster templates
Apr 12, 2024
7ab4335
Improve handling of empty extra labels variable
Apr 16, 2024
a545002
Ensure required Magnum images are public
Apr 16, 2024
b0ae102
Merge pull request #27 from stackhpc/feat/allow-extra-magnum-labels
markgoddard Apr 17, 2024
e12b0f3
Merge pull request #28 from stackhpc/fix/magnum-image-visibility
markgoddard Apr 17, 2024
7801226
Update readme python venv instructions
Alex-Welsh Apr 22, 2024
00fb091
Merge pull request #29 from stackhpc/readme
markgoddard Apr 22, 2024
3d085a4
Allow unlimited server groups for Octavia
priteau May 7, 2024
786bada
Merge pull request #30 from stackhpc/octavia-server-group
priteau May 8, 2024
7f0e070
removed mention of Yoga
g0rgamesh Jun 3, 2024
b6d80b8
Merge pull request #31 from stackhpc/readme_update
g0rgamesh Jun 3, 2024
1fd68c8
Rework example security group to avoid SSH and ICMP in default secgroup
markgoddard Jul 8, 2024
707f921
Merge pull request #32 from stackhpc/example-secgroups
markgoddard Jul 8, 2024
54668be
Add ansible.cfg
cityofships Aug 14, 2024
2b63171
Bump stackhpc.openstack collection to 0.2.2
markgoddard Aug 14, 2024
e730ee1
Merge pull request #33 from stackhpc/ansible_cfg
markgoddard Aug 16, 2024
8cf03a8
Merge pull request #34 from stackhpc/bump-collection
markgoddard Aug 20, 2024
602136d
Fix Azimuth artefact URLs
cityofships Sep 26, 2024
6a15739
Use 22.04 in magnum-capi-images.j2
MoteHue Oct 14, 2024
6e18848
Use the latest collection
cityofships Nov 6, 2024
37ac0df
Merge pull request #39 from stackhpc/bump_collection
bbezak Nov 6, 2024
07e05c1
Support configuring Cinder volume types
priteau Dec 10, 2024
e17bed6
Merge pull request #40 from stackhpc/volume-types
priteau Dec 10, 2024
2074767
bump openstack.cloud version
GregWhiteyBialas Jan 22, 2025
b095d5a
Merge pull request #43 from stackhpc/opensctackcloud_version_bump
GregWhiteyBialas Jan 22, 2025
0a3a558
add default var definition for openstack_volumes_types
g0rgamesh Jan 29, 2025
156a803
Merge pull request #44 from stackhpc/volume_type_fix
g0rgamesh Jan 29, 2025
8576553
CI: Add ansible-lint
mnasiadka Jan 29, 2025
abe8e80
Fix all ansible-lint issues
mnasiadka Jan 29, 2025
699b14a
Merge pull request #45 from stackhpc/ci
g0rgamesh Jan 29, 2025
521f00b
make cloudkitty playbooks optional
g0rgamesh Jan 29, 2025
6233dd7
new line
g0rgamesh Jan 29, 2025
56a54b0
Merge pull request #46 from stackhpc/cloudkitty_opt-in
g0rgamesh Jan 29, 2025
4c36b5e
set GRUB vars in example file
g0rgamesh Feb 18, 2025
e55953a
Merge pull request #47 from stackhpc/grub_vars
g0rgamesh Feb 18, 2025
d450155
Merge pull request #38 from stackhpc/jammy-magnum-templates
MoteHue Feb 27, 2025
80516bc
Add newer version of ansible for later python
seunghun1ee Mar 18, 2025
c2508a6
Merge pull request #50 from stackhpc/master-test
mnasiadka Mar 18, 2025
c382516
Merge remote-tracking branch 'generic/main' into generic-config-sync
seunghun1ee Mar 19, 2025
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
26 changes: 16 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ OpenStack Configuration
=============================================

This project contains Ansible playbooks and configuration of infrastructure on
an existing OpenStack cloud for the OpenStack system. (Supported up to Yoga
release.)
an existing OpenStack cloud for the OpenStack system.

Preparation
===========

Ensure that Ansible is installed, either via the system package manager or pip.
If required, use a virtualenv to avoid interference with the system python
packages. For example:
It is recommended that you use a python virtual environment to avoid
interference with the system python packages. For example:

.. code-block::

$ virtualenv venv
$ source venv/bin/activate
$ python3 -m venv openstack-venv
$ source openstack-venv/bin/activate
$ python -m pip install --upgrade pip
$ pip install -r requirements.txt

Install Ansible role and collection dependencies from Ansible Galaxy:

.. code-block::

$ ansible-galaxy collection install \
-p ansible/collections \
-r requirements.yml
Expand Down Expand Up @@ -87,10 +87,16 @@ variables in `etc/openstack-config.yml`

.. code-block:: yaml

magnum_default_master_flavor_name: # Chosen flavor on target cloud
magnum_default_worker_flavor_name: # Chosen flavor on target cloud
magnum_external_net_name: # External network
magnum_loadbalancer_provider: # Octavia provider (e.g. 'ovn')
# Chosen flavor on target cloud
magnum_default_master_flavor_name:
# Chosen flavor on target cloud
magnum_default_worker_flavor_name:
# External network to use for load balancers etc.
magnum_external_net_name:
# Octavia provider (e.g. 'ovn')
magnum_loadbalancer_provider:
# Optional list of extra labels to add to all generated cluster templates
magnum_template_extra_labels:

then run the provided playbook with

Expand Down
4 changes: 4 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[defaults]
bin_ansible_callbacks = True
callbacks_enabled = ansible.posix.profile_tasks
stdout_callback = yaml
104 changes: 53 additions & 51 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/stackhpc/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/stackhpc/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/stackhpc/azimuth-images/{{ dependencies_response.json['azimuth-images'] }}/manifest.json
# 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/stackhpc/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"
23 changes: 23 additions & 0 deletions ansible/group_vars/all/openstack
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,26 @@ openstack_host_aggregates: []
# List of clusters templates in the openstack project. Format is as required by the
# stackhpc.os-container-clusters role.
openstack_container_clusters_templates: []

###############################################################################
# Configuration variables for a CloudKitty ratings service deployment.

# 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 README.md file.
#
openstack_ratings_hashmap_field_mappings: []

# 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: []

###############################################################################
# Configuration of volumes for OpenStack.
openstack_volumes_types: []

###############################################################################
# Configuration of Cloudkitty for OpenStack.
openstack_cloudkitty_enable: false
10 changes: 10 additions & 0 deletions ansible/openstack-ratings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Generate OpenStack software ratings
hosts: localhost
tags:
- ratings
roles:
- role: stackhpc.openstack.os_ratings
os_ratings_hashmap_field_mappings: "{{ openstack_ratings_hashmap_field_mappings }}"
os_ratings_hashmap_service_mappings: "{{ openstack_ratings_hashmap_service_mappings }}"
os_ratings_venv: "{{ openstack_venv }}"
12 changes: 12 additions & 0 deletions ansible/openstack-volume-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Ensure OpenStack volume types exist
hosts: localhost
tags:
- volume-types
roles:
- role: stackhpc.openstack.os_volumes
os_volumes_venv: "{{ openstack_venv }}"
os_volumes_auth_type: "{{ openstack_auth_type }}"
os_volumes_auth: "{{ openstack_auth }}"
os_volumes_cacert: "{{ openstack_cacert }}"
os_volumes_types: "{{ openstack_volumes_types }}"
16 changes: 10 additions & 6 deletions ansible/openstack.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
# 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-container-clusters.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]
when: openstack_cloudkitty_enable | bool
4 changes: 2 additions & 2 deletions ansible/templates/magnum-capi-images.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
name: "{{ item.value.name }}"
type: qcow2
image_url: "{{ item.value.url }}"
visibility: "community"
visibility: "public"
properties:
os_distro: "ubuntu"
os_version: "20.04"
os_version: "22.04"
kube_version: "{{ item.value.kubernetes_version }}"

{% endfor %}
5 changes: 4 additions & 1 deletion ansible/templates/magnum-capi-templates.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
keystone_auth_enabled: "false"
capi_helm_chart_version: "{{ capi_helm_chart_release_data.json.tag_name }}"
octavia_provider: {{ magnum_loadbalancer_provider }}
{% if magnum_template_extra_labels is defined and magnum_template_extra_labels is not none %}
{{ magnum_template_extra_labels | to_nice_yaml | indent(4) -}}
{% endif %}
external_network_id: {{ magnum_external_net_name }}
master_flavor: {{ magnum_default_master_flavor_name }}
flavor: {{ magnum_default_worker_flavor_name }}
Expand All @@ -28,4 +31,4 @@
dns_nameserver: "{{ (magnum_cluster_default_dns_nameservers | default(['1.1.1.1', '8.8.8.8', '8.8.4.4'])) | join(',') }}"
public: "{{ magnum_cluster_templates_public | default('True') }}"

{% endfor %}
{% endfor %}
Loading