Skip to content

Commit 522a5e1

Browse files
authored
Merge branch 'main' into flavors
2 parents c9ec170 + 8f718d5 commit 522a5e1

File tree

47 files changed

+1999
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1999
-218
lines changed

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tags:
1212
- cloud
1313
- openstack
1414
dependencies:
15-
openstack.cloud: "*"
15+
"openstack.cloud": ">=2.1.0"
1616
repository: https://github.com/stackhpc/ansible-collection-openstack
1717
documentation: https://github.com/stackhpc/ansible-collection-openstack/branch/main/README.md
1818
homepage: https://github.com/stackhpc/ansible-collection-openstack

plugins/modules/baremetal_deploy_template.py

Lines changed: 0 additions & 206 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
OpenStack Container Clusters
2+
============================
3+
4+
This role can be used to register container cluster templates in Magnum
5+
using the Magnum CLI.
6+
7+
Requirements
8+
------------
9+
10+
The OpenStack Magnum API should be accessible from the target host.
11+
12+
Role Variables
13+
--------------
14+
15+
`os_container_clusters_venv` is a path to a directory in which to create a
16+
virtualenv.
17+
18+
`os_container_clusters_auth_type` is an authentication type compatible with the
19+
`auth_type` argument of `openstack.cloud` Ansible modules.
20+
21+
`os_container_clusters_auth` is a dict containing authentication information
22+
compatible with the `auth` argument of `openstack.cloud` Ansible modules.
23+
24+
`os_container_clusters_cacert` is an optional path to a CA certificate bundle.
25+
26+
`os_container_clusters_templates` is a list of Magnum container cluster
27+
templates to register. Each item should be a dict containing container cluster
28+
template attributes.
29+
30+
`os_container_clusters_public`: whether to register templates as public by
31+
default. Default is `false`.
32+
33+
`os_container_clusters_templates_hide` (optional) whether to hide the given
34+
list of cluster templates by default. The `is_hidden` attribute can be used on
35+
individual templates to specify this as well. Default is False.
36+
37+
Dependencies
38+
------------
39+
40+
This role depends on the `stackhpc.openstack.os_openstackclient` and
41+
`stackhpc.openstack.os_openstacksdk` roles.
42+
43+
Example Playbook
44+
----------------
45+
46+
The following playbook registers a cluster template.
47+
48+
---
49+
- name: Ensure cluster templates are registered
50+
hosts: localhost
51+
roles:
52+
- role: stackhpc.openstack.os_container_clusters
53+
os_container_clusters_venv: "~/os-container-clusters-venv"
54+
os_container_clusters_auth_type: "password"
55+
os_container_clusters_auth:
56+
project_name: <keystone project>
57+
username: <keystone user>
58+
password: <keystone password>
59+
auth_url: <keystone auth URL>
60+
os_container_clusters_templates:
61+
- name: swarm-cluster
62+
coe: swarm
63+
master_flavor: m1.small
64+
flavor: m1.small
65+
image: fedora-25
66+
external_network: ext
67+
floating_ip_disabled: # leave empty to pass as flag without assigning value
68+
labels:
69+
etcd_volume_size: 3
70+
71+
Author Information
72+
------------------
73+
74+
- Mark Goddard (<[email protected]>)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
# Path to a directory in which to create a virtualenv.
3+
os_container_clusters_venv:
4+
# Authentication type.
5+
os_container_clusters_auth_type:
6+
# Authentication information.
7+
os_container_clusters_auth: {}
8+
# List of magnum container cluster templates. Each item should be a dict
9+
# mapping container cluster template attribute names to their values.
10+
os_container_clusters_templates: []
11+
# Upper constraints file for installation of python dependencies.
12+
os_container_clusters_upper_constraints_file:
13+
# Whether to make templates public
14+
os_container_clusters_public: false
15+
# Whether to hide templates by default
16+
os_container_clusters_templates_hide: false
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
dependencies:
3+
- role: stackhpc.openstack.os_openstacksdk
4+
os_openstacksdk_venv: "{{ os_container_clusters_venv }}"
5+
os_openstacksdk_upper_constraints_file: "{{ os_container_clusters_upper_constraints_file }}"
6+
- role: stackhpc.openstack.os_openstackclient
7+
os_openstackclient_venv: "{{ os_container_clusters_venv }}"
8+
os_openstackclient_upper_constraints_file: "{{ os_container_clusters_upper_constraints_file }}"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
- name: Ensure magnum client is installed
3+
ansible.builtin.pip:
4+
name: python-magnumclient
5+
state: present
6+
virtualenv: "{{ os_container_clusters_venv or omit }}"
7+
become: "{{ os_container_clusters_venv == None }}"
8+
9+
- name: Set a fact about the Ansible python interpreter
10+
ansible.builtin.set_fact:
11+
old_ansible_python_interpreter: "{{ ansible_python_interpreter | default('/usr/bin/python3') }}"
12+
13+
- name: Ensure container cluster templates exist
14+
vars:
15+
ansible_python_interpreter: "{{ os_container_clusters_venv ~ '/bin/python' if os_container_clusters_venv != None else old_ansible_python_interpreter }}"
16+
openstack.cloud.coe_cluster_template:
17+
auth: "{{ os_container_clusters_auth }}"
18+
auth_type: "{{ os_container_clusters_auth_type }}"
19+
cacert: "{{ os_container_clusters_cacert | default(omit) }}"
20+
interface: "{{ os_container_clusters_interface | default(omit, true) }}"
21+
labels: "{{ item.labels | default(omit) }}"
22+
external_network_id: "{{ item.external_network_id | default(undef(hint='You must provide an external network')) }}"
23+
master_flavor_id: "{{ item.master_flavor | default(undef(hint='You must provide a master flavor')) }}"
24+
flavor_id: "{{ item.flavor | default(undef(hint='You must provide a flavor')) }}"
25+
image_id: "{{ item.image | default(undef(hint='You must provide an image')) }}"
26+
name: "{{ item.name | default(undef(hint='You must provide a name')) }}"
27+
coe: "{{ item.coe | default(undef(hint='You must provide a coe')) }}"
28+
network_driver: "{{ item.network_driver | default(omit) }}"
29+
master_lb_enabled: "{{ item.master_lb_enabled | default(True) | bool }}"
30+
floating_ip_enabled: "{{ item.floating_ip_enabled | default(True) | bool }}"
31+
dns_nameserver: "{{ item.dns_nameserver | default(omit) }}"
32+
public: "{{ item.public | default(os_container_clusters_public) | bool }}"
33+
docker_volume_size: "{{ item.docker_volume_size | default(omit) }}"
34+
fixed_network: "{{ item.fixed_network | default(omit) }}"
35+
fixed_subnet: "{{ item.fixed_subnet | default(omit) }}"
36+
registry_enabled: "{{ item.registry_enabled | default(omit) }}"
37+
tls_disabled: "{{ item.tls_disabled | default(omit) }}"
38+
keypair_id: "{{ item.keypair_id | default(omit) }}"
39+
volume_driver: "{{ item.volume_driver | default(omit) }}"
40+
http_proxy: "{{ item.http_proxy | default(omit) }}"
41+
https_proxy: "{{ item.https_proxy | default(omit) }}"
42+
no_proxy: "{{ item.no_proxy | default(omit) }}"
43+
state: "{{ item.state | default(omit) }}"
44+
with_items: "{{ os_container_clusters_templates }}"
45+
46+
# NOTE: The coe_cluster_template module does not currently support setting the
47+
# hidden parameter.
48+
- name: Hide cluster templates if specified
49+
ansible.builtin.command: >
50+
{{ os_container_clusters_venv ~ '/bin/' if os_container_clusters_venv else '' }}openstack
51+
{% for auth_name, auth_value in os_container_clusters_auth.items() %}
52+
--os-{{ auth_name | replace('_', '-') }}='{{ auth_value }}'
53+
{% endfor %}
54+
{% if os_container_clusters_cacert is defined %}
55+
--os-cacert {{ os_container_clusters_cacert }}
56+
{% endif %}
57+
--os-interface=public
58+
coe cluster template update {{ item.name }} replace hidden=True
59+
with_items: "{{ os_container_clusters_templates }}"
60+
when: item.is_hidden | default(os_container_clusters_templates_hide) | bool
61+
changed_when: true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
localhost ansible_connection='local' ansible_python_interpreter='/usr/bin/env python'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- name: Test os_container_clusters role
3+
hosts: all
4+
connection: local
5+
roles:
6+
- stackhpc.openstack.os_container_clusters

roles/os_deploy_templates/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ catalog. Maybe be one of `public`, `admin`, or `internal`.
3434

3535
`os_deploy_templates` is a list of Ironic deploy templates to register. Each
3636
item should be a dict containing following items:
37-
* `name`: Name of the deploy template.
38-
* `steps`: List of deploy steps.
37+
* `name`: Name of the deploy template. Required when the deploy template is
38+
created, after which the name or ID may be used.
39+
* `steps`: List of deploy steps. Required when the deploy template is created.
3940
* `extra`: Dict of metadata, optional.
4041
* `uuid`: UUID, optional.
4142
* `state`: State, optional.

0 commit comments

Comments
 (0)