diff --git a/.gitignore b/.gitignore index 9e643f78d..bfb90b653 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ ansible/roles/mrlesmithjr.manage-lvm/ ansible/roles/MichaelRigart.interfaces/ ansible/roles/stackhpc.drac/ ansible/roles/stackhpc.drac-facts/ +ansible/roles/stackhpc.os-flavors/ ansible/roles/stackhpc.os-openstackclient/ ansible/roles/stackhpc.os-projects/ ansible/roles/stackhpc.os-shade/ diff --git a/ansible/compute-node-flavors.yml b/ansible/compute-node-flavors.yml index 234092737..4170f95e2 100644 --- a/ansible/compute-node-flavors.yml +++ b/ansible/compute-node-flavors.yml @@ -36,7 +36,7 @@ ironic_node_flavor_properties: [] existing_nova_flavors: "{{ nova_flavor_list.stdout | from_json }}" relevant_existing_flavors: [] - nova_flavors: [] + os_flavors: [] # Build a list of nodes' flavor-relevant properties. - name: Set a fact containing the ironic node properties @@ -68,8 +68,8 @@ # won't work for a list of names other than 0 to N-1. - name: Set a fact containing a list of flavors to register in nova set_fact: - nova_flavors: > - {{ nova_flavors + + os_flavors: > + {{ os_flavors + [item.1 | combine({'name': flavor_base_name ~ (item.0 + relevant_existing_flavors | length)})] }} with_indexed_items: > {{ ironic_node_flavor_properties | @@ -79,7 +79,7 @@ # Register the new flavors. - include_role: - role: nova-flavors - nova_flavors_venv: "{{ venv }}" - nova_flavors_auth_type: "{{ openstack_auth_type }}" - nova_flavors_auth: "{{ openstack_auth }}" + role: stackhpc.os-flavors + os_flavors_venv: "{{ venv }}" + os_flavors_auth_type: "{{ openstack_auth_type }}" + os_flavors_auth: "{{ openstack_auth }}" diff --git a/ansible/requirements.yml b/ansible/requirements.yml index 5875ab488..b274f206d 100644 --- a/ansible/requirements.yml +++ b/ansible/requirements.yml @@ -6,5 +6,6 @@ - src: resmo.ntp - src: stackhpc.drac - src: stackhpc.drac-facts +- src: stackhpc.os-flavors - src: stackhpc.os-projects - src: yatesr.timezone diff --git a/ansible/roles/nova-flavors/README.md b/ansible/roles/nova-flavors/README.md deleted file mode 100644 index bf7bbb2c4..000000000 --- a/ansible/roles/nova-flavors/README.md +++ /dev/null @@ -1,59 +0,0 @@ -Nova Flavors -============ - -This role can be used to register flavors in nova using the -os\_nova\_flavor module. - -Requirements ------------- - -The OpenStack nova API should be accessible from the target host. - -Role Variables --------------- - -`nova_flavors_venv` is a path to a directory in which to create a -virtualenv. - -`nova_flavors_auth_type` is an authentication type compatible with -the `auth_type` argument of `os_*` Ansible modules. - -`nova_flavors_auth` is a dict containing authentication information -compatible with the `auth` argument of `os_*` Ansible modules. - -`nova_flavors` is a list of nova flavors to register. Each item should be a -dict containing the items 'name', 'ram', 'disk', and 'vcpus'. Optionally, the -dict may contain 'ephemeral' and 'swap' items. - -Dependencies ------------- - -This role depends on the Kayobe `shade` role. - -Example Playbook ----------------- - -The following playbook registers a nova flavor. - - --- - - name: Ensure nova flavors are registered - hosts: nova-api - roles: - - role: nova-flavors - nova_flavors_venv: "~/nova-flavors-venv" - nova_flavors_auth_type: "password" - nova_flavors_auth: - project_name: - username: - password: - auth_url: - nova_flavors: - name: flavor-1 - ram: 1024 - disk: 1024 - vcpus: 2 - -Author Information ------------------- - -- Mark Goddard () diff --git a/ansible/roles/nova-flavors/defaults/main.yml b/ansible/roles/nova-flavors/defaults/main.yml deleted file mode 100644 index 79e03be03..000000000 --- a/ansible/roles/nova-flavors/defaults/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# Path to a directory in which to create a virtualenv. -nova_flavors_venv: - -# Authentication type. -nova_flavors_auth_type: - -# Authentication information. -nova_flavors_auth: {} - -# List of nova flavors to register. Each item should be a dict containing the -# items 'name', 'ram', 'disk', and 'vcpus'. Optionally, the dict may contain -# 'ephemeral' and 'swap' items. -nova_flavors: [] diff --git a/ansible/roles/nova-flavors/meta/main.yml b/ansible/roles/nova-flavors/meta/main.yml deleted file mode 100644 index 6b8be6954..000000000 --- a/ansible/roles/nova-flavors/meta/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -dependencies: - - role: stackhpc.os-shade - os_shade_venv: "{{ nova_flavors_venv }}" diff --git a/ansible/roles/nova-flavors/tasks/main.yml b/ansible/roles/nova-flavors/tasks/main.yml deleted file mode 100644 index f407fcf0f..000000000 --- a/ansible/roles/nova-flavors/tasks/main.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -- name: Set a fact to ensure Ansible uses the python interpreter in the virtualenv - set_fact: - ansible_python_interpreter: "{{ nova_flavors_venv }}/bin/python" - -- name: Ensure nova flavors exist - os_nova_flavor: - auth_type: "{{ nova_flavors_auth_type }}" - auth: "{{ nova_flavors_auth }}" - name: "{{ item.name }}" - ram: "{{ item.ram }}" - vcpus: "{{ item.vcpus }}" - disk: "{{ item.disk }}" - ephemeral: "{{ item.ephemeral | default(omit) }}" - swap: "{{ item.swap | default(omit) }}" - state: present - with_items: "{{ nova_flavors }}" - -# This variable is unset before we set it, and it does not appear to be -# possible to unset a variable in Ansible. -- name: Set a fact to reset the Ansible python interpreter - set_fact: - ansible_python_interpreter: /usr/bin/python