Switch from shade to openstacksdk
Upstream Ansible OpenStack modules now use openstacksdk rather than shade. Switch local Ansible modules to follow suit. Also switch to use the stackhpc.os_openstacksdk role from stackhpc.os-shade. The stackhpc.os-shade role is removed during 'kayobe control host upgrade'. Change-Id: Id3894c3c36ef99f00ed463de6a3457e11733d6b7 Story: 2007294 Task: 38759
This commit is contained in:
parent
3de40b57ba
commit
2de3a2c578
@ -3,20 +3,20 @@
|
|||||||
# baremetal-compute ansible group are inspected. The nodes should be in the
|
# baremetal-compute ansible group are inspected. The nodes should be in the
|
||||||
# 'manageable' state.
|
# 'manageable' state.
|
||||||
|
|
||||||
# We install shade in a virtualenv on one of the controllers, and delegate to
|
# We install openstacksdk in a virtualenv on one of the controllers, and delegate to
|
||||||
# it when executing the stackhpc.os-ironic-state role.
|
# it when executing the stackhpc.os-ironic-state role.
|
||||||
|
|
||||||
- name: Ensure dependencies are installed and the virtual environment is activated
|
- name: Ensure dependencies are installed and the virtual environment is activated
|
||||||
hosts: controllers[0]
|
hosts: controllers[0]
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
vars:
|
vars:
|
||||||
venv: "{{ virtualenv_path }}/shade"
|
venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
roles:
|
roles:
|
||||||
- role: stackhpc.os-shade
|
- role: stackhpc.os_openstacksdk
|
||||||
os_shade_venv: "{{ venv }}"
|
os_openstacksdk_venv: "{{ venv }}"
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
os_shade_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
os_openstacksdk_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
|
|
||||||
- role: activate-virtualenv
|
- role: activate-virtualenv
|
||||||
activate_virtualenv_path: "{{ venv }}"
|
activate_virtualenv_path: "{{ venv }}"
|
||||||
|
@ -3,20 +3,20 @@
|
|||||||
# ironic inventory are manageable. Supported initial states include 'enroll',
|
# ironic inventory are manageable. Supported initial states include 'enroll',
|
||||||
# 'manageable', and 'available'.
|
# 'manageable', and 'available'.
|
||||||
|
|
||||||
# We install shade in a virtualenv on one of the controllers, and delegate to
|
# We install openstacksdk in a virtualenv on one of the controllers, and delegate to
|
||||||
# it when executing the stackhpc.os-ironic-state role.
|
# it when executing the stackhpc.os-ironic-state role.
|
||||||
|
|
||||||
- name: Ensure baremetal compute nodes are available in ironic
|
- name: Ensure baremetal compute nodes are available in ironic
|
||||||
hosts: controllers[0]
|
hosts: controllers[0]
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
vars:
|
vars:
|
||||||
venv: "{{ virtualenv_path }}/shade"
|
venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
roles:
|
roles:
|
||||||
- role: stackhpc.os-shade
|
- role: stackhpc.os_openstacksdk
|
||||||
os_shade_venv: "{{ venv }}"
|
os_openstacksdk_venv: "{{ venv }}"
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
os_shade_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
os_openstacksdk_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
|
|
||||||
- role: activate-virtualenv
|
- role: activate-virtualenv
|
||||||
activate_virtualenv_path: "{{ venv }}"
|
activate_virtualenv_path: "{{ venv }}"
|
||||||
|
@ -3,20 +3,20 @@
|
|||||||
# ironic inventory are available. Supported initial states include 'enroll' and
|
# ironic inventory are available. Supported initial states include 'enroll' and
|
||||||
# 'manageable'.
|
# 'manageable'.
|
||||||
|
|
||||||
# We install shade in a virtualenv on one of the controllers, and delegate to
|
# We install openstacksdk in a virtualenv on one of the controllers, and delegate to
|
||||||
# it when executing the stackhpc.os-ironic-state role.
|
# it when executing the stackhpc.os-ironic-state role.
|
||||||
|
|
||||||
- name: Ensure baremetal compute nodes are available in ironic
|
- name: Ensure baremetal compute nodes are available in ironic
|
||||||
hosts: controllers[0]
|
hosts: controllers[0]
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
vars:
|
vars:
|
||||||
venv: "{{ virtualenv_path }}/shade"
|
venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
roles:
|
roles:
|
||||||
- role: stackhpc.os-shade
|
- role: stackhpc.os_openstacksdk
|
||||||
os_shade_venv: "{{ venv }}"
|
os_openstacksdk_venv: "{{ venv }}"
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
os_shade_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
os_openstacksdk_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
|
|
||||||
- role: activate-virtualenv
|
- role: activate-virtualenv
|
||||||
activate_virtualenv_path: "{{ venv }}"
|
activate_virtualenv_path: "{{ venv }}"
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
hosts: controllers[0]
|
hosts: controllers[0]
|
||||||
roles:
|
roles:
|
||||||
- role: stackhpc.os-networks
|
- role: stackhpc.os-networks
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
os_shade_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
os_openstacksdk_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
os_networks_venv: "{{ virtualenv_path }}/shade"
|
os_networks_venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
os_networks_openstack_auth_type: "{{ openstack_auth_type }}"
|
os_networks_openstack_auth_type: "{{ openstack_auth_type }}"
|
||||||
os_networks_openstack_auth: "{{ openstack_auth }}"
|
os_networks_openstack_auth: "{{ openstack_auth }}"
|
||||||
# Network configuration.
|
# Network configuration.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
tags:
|
tags:
|
||||||
- grafana
|
- grafana
|
||||||
vars:
|
vars:
|
||||||
venv: "{{ virtualenv_path }}/shade"
|
venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
roles:
|
roles:
|
||||||
- role: stackhpc.os-openstackclient
|
- role: stackhpc.os-openstackclient
|
||||||
os_openstackclient_venv: "{{ venv }}"
|
os_openstackclient_venv: "{{ venv }}"
|
||||||
|
@ -123,9 +123,9 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: ironic-inspector-rules
|
- role: ironic-inspector-rules
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
ironic_inspector_venv: "{{ virtualenv_path }}/shade"
|
ironic_inspector_venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
ironic_inspector_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
ironic_inspector_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
ironic_inspector_auth_type: "{{ openstack_auth_type }}"
|
ironic_inspector_auth_type: "{{ openstack_auth_type }}"
|
||||||
ironic_inspector_auth: "{{ openstack_auth }}"
|
ironic_inspector_auth: "{{ openstack_auth }}"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
tags:
|
tags:
|
||||||
- introspection-rules
|
- introspection-rules
|
||||||
vars:
|
vars:
|
||||||
venv: "{{ virtualenv_path }}/shade"
|
venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Validate OpenStack password authentication parameters
|
- name: Validate OpenStack password authentication parameters
|
||||||
fail:
|
fail:
|
||||||
@ -57,8 +57,8 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: ironic-inspector-rules
|
- role: ironic-inspector-rules
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
ironic_inspector_venv: "{{ venv }}"
|
ironic_inspector_venv: "{{ venv }}"
|
||||||
ironic_inspector_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
ironic_inspector_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
ironic_inspector_auth_type: "{{ openstack_auth_type }}"
|
ironic_inspector_auth_type: "{{ openstack_auth_type }}"
|
||||||
|
@ -99,9 +99,9 @@
|
|||||||
- item.src != item.dest
|
- item.src != item.dest
|
||||||
roles:
|
roles:
|
||||||
- role: ipa-images
|
- role: ipa-images
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
ipa_images_venv: "{{ virtualenv_path }}/shade"
|
ipa_images_venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
ipa_images_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
ipa_images_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
ipa_images_openstack_auth_type: "{{ openstack_auth_type }}"
|
ipa_images_openstack_auth_type: "{{ openstack_auth_type }}"
|
||||||
ipa_images_openstack_auth: "{{ openstack_auth }}"
|
ipa_images_openstack_auth: "{{ openstack_auth }}"
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
hosts: controllers_for_provision_net_True[0]
|
hosts: controllers_for_provision_net_True[0]
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
vars:
|
vars:
|
||||||
venv: "{{ virtualenv_path }}/shade"
|
venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
provision_net:
|
provision_net:
|
||||||
name: "{{ kolla_ironic_provisioning_network }}"
|
name: "{{ kolla_ironic_provisioning_network }}"
|
||||||
provider_network_type: "{% if provision_wl_net_name | net_vlan %}vlan{% else %}flat{% endif %}"
|
provider_network_type: "{% if provision_wl_net_name | net_vlan %}vlan{% else %}flat{% endif %}"
|
||||||
@ -61,9 +61,9 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: stackhpc.os-networks
|
- role: stackhpc.os-networks
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
os_shade_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
os_openstacksdk_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
os_networks_venv: "{{ venv }}"
|
os_networks_venv: "{{ venv }}"
|
||||||
os_networks_auth_type: "{{ openstack_auth_type }}"
|
os_networks_auth_type: "{{ openstack_auth_type }}"
|
||||||
os_networks_auth: "{{ openstack_auth }}"
|
os_networks_auth: "{{ openstack_auth }}"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
# Path to virtualenv in which to install shade and its dependencies.
|
# Path to virtualenv in which to install openstacksdk and its dependencies.
|
||||||
ipa_images_venv:
|
ipa_images_venv:
|
||||||
|
|
||||||
# Upper constraints file for installation of python-ironicclient.
|
# Upper constraints file for installation of python-ironicclient.
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
dependencies:
|
dependencies:
|
||||||
- role: stackhpc.os-shade
|
- role: stackhpc.os_openstacksdk
|
||||||
os_shade_venv: "{{ ipa_images_venv }}"
|
os_openstacksdk_venv: "{{ ipa_images_venv }}"
|
||||||
os_shade_upper_constraints_file: "{{ ipa_images_upper_constraints_file }}"
|
os_openstacksdk_upper_constraints_file: "{{ ipa_images_upper_constraints_file }}"
|
||||||
- role: stackhpc.os-openstackclient
|
- role: stackhpc.os-openstackclient
|
||||||
os_openstackclient_venv: "{{ ipa_images_venv }}"
|
os_openstackclient_venv: "{{ ipa_images_venv }}"
|
||||||
os_openstackclient_upper_constraints_file: "{{ ipa_images_upper_constraints_file }}"
|
os_openstackclient_upper_constraints_file: "{{ ipa_images_upper_constraints_file }}"
|
||||||
|
@ -36,7 +36,7 @@ for rules.
|
|||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
|
|
||||||
This role depends on the Kayobe `shade` role.
|
This role depends on the Kayobe `openstacksdk` role.
|
||||||
|
|
||||||
Example Playbook
|
Example Playbook
|
||||||
----------------
|
----------------
|
||||||
|
@ -24,7 +24,7 @@ try:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
IMPORT_ERRORS.append(e)
|
IMPORT_ERRORS.append(e)
|
||||||
try:
|
try:
|
||||||
import shade
|
import openstack
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
IMPORT_ERRORS.append(e)
|
IMPORT_ERRORS.append(e)
|
||||||
|
|
||||||
@ -76,17 +76,15 @@ os_ironic_inspector_rule:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def _build_client(module):
|
def _build_client(module, cloud):
|
||||||
"""Create and return an Ironic inspector client."""
|
"""Create and return an Ironic inspector client."""
|
||||||
cloud = shade.operator_cloud(**module.params)
|
|
||||||
session = cloud.cloud_config.get_session()
|
|
||||||
# Ensure the requested API version is supported.
|
# Ensure the requested API version is supported.
|
||||||
# API 1.14 is the latest API version available in Rocky.
|
# API 1.14 is the latest API version available in Rocky.
|
||||||
api_version = (1, 14)
|
api_version = (1, 14)
|
||||||
client = ironic_inspector_client.v1.ClientV1(
|
client = ironic_inspector_client.v1.ClientV1(
|
||||||
inspector_url=module.params['inspector_url'],
|
inspector_url=module.params['inspector_url'],
|
||||||
interface=module.params['interface'],
|
interface=module.params['interface'],
|
||||||
session=session, region_name=module.params['region_name'],
|
session=cloud.session, region_name=module.params['region_name'],
|
||||||
api_version=api_version)
|
api_version=api_version)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
@ -161,8 +159,9 @@ def main():
|
|||||||
endpoint=module.params['inspector_url']
|
endpoint=module.params['inspector_url']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sdk, cloud = openstack_cloud_from_module(module)
|
||||||
try:
|
try:
|
||||||
client = _build_client(module)
|
client = _build_client(module, cloud)
|
||||||
if module.params["state"] == "present":
|
if module.params["state"] == "present":
|
||||||
changed = _ensure_rule_present(module, client)
|
changed = _ensure_rule_present(module, client)
|
||||||
else:
|
else:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
dependencies:
|
dependencies:
|
||||||
- role: stackhpc.os-shade
|
- role: stackhpc.os_openstacksdk
|
||||||
os_shade_venv: "{{ ironic_inspector_venv }}"
|
os_openstacksdk_venv: "{{ ironic_inspector_venv }}"
|
||||||
os_shade_upper_constraints_file: "{{ ironic_inspector_upper_constraints_file }}"
|
os_openstacksdk_upper_constraints_file: "{{ ironic_inspector_upper_constraints_file }}"
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
- introspection-rules
|
- introspection-rules
|
||||||
roles:
|
roles:
|
||||||
- role: ironic-inspector-rules
|
- role: ironic-inspector-rules
|
||||||
os_shade_install_epel: "{{ yum_install_epel }}"
|
os_openstacksdk_install_epel: "{{ yum_install_epel }}"
|
||||||
os_shade_state: latest
|
os_openstacksdk_state: latest
|
||||||
ironic_inspector_venv: "{{ virtualenv_path }}/shade"
|
ironic_inspector_venv: "{{ virtualenv_path }}/openstacksdk"
|
||||||
ironic_inspector_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
ironic_inspector_upper_constraints_file: "{{ pip_upper_constraints_file }}"
|
||||||
# No auth required for Bifrost.
|
# No auth required for Bifrost.
|
||||||
ironic_inspector_auth_type: None
|
ironic_inspector_auth_type: None
|
||||||
|
@ -271,10 +271,7 @@ def prune_galaxy_roles(parsed_args):
|
|||||||
"""
|
"""
|
||||||
LOG.info("Removing unnecessary galaxy roles from kayobe")
|
LOG.info("Removing unnecessary galaxy roles from kayobe")
|
||||||
roles_to_remove = [
|
roles_to_remove = [
|
||||||
'stackhpc.os-flavors',
|
'stackhpc.os-shade',
|
||||||
'stackhpc.os-projects',
|
|
||||||
'stackhpc.parted-1-1',
|
|
||||||
'stackhpc.timezone',
|
|
||||||
]
|
]
|
||||||
LOG.debug("Removing roles: %s", ",".join(roles_to_remove))
|
LOG.debug("Removing roles: %s", ",".join(roles_to_remove))
|
||||||
utils.galaxy_remove(roles_to_remove, "ansible/roles")
|
utils.galaxy_remove(roles_to_remove, "ansible/roles")
|
||||||
|
@ -468,10 +468,7 @@ class TestCase(unittest.TestCase):
|
|||||||
ansible.prune_galaxy_roles(parsed_args)
|
ansible.prune_galaxy_roles(parsed_args)
|
||||||
|
|
||||||
expected_roles = [
|
expected_roles = [
|
||||||
'stackhpc.os-flavors',
|
'stackhpc.os-shade',
|
||||||
'stackhpc.os-projects',
|
|
||||||
'stackhpc.parted-1-1',
|
|
||||||
'stackhpc.timezone',
|
|
||||||
]
|
]
|
||||||
mock_remove.assert_called_once_with(expected_roles,
|
mock_remove.assert_called_once_with(expected_roles,
|
||||||
"ansible/roles")
|
"ansible/roles")
|
||||||
|
@ -30,14 +30,14 @@
|
|||||||
- src: stackhpc.mellanox-switch
|
- src: stackhpc.mellanox-switch
|
||||||
version: v1.0.0
|
version: v1.0.0
|
||||||
- src: stackhpc.os-images
|
- src: stackhpc.os-images
|
||||||
version: v1.7.0
|
version: v1.8.0
|
||||||
- src: stackhpc.os-ironic-state
|
- src: stackhpc.os-ironic-state
|
||||||
version: v1.2.0
|
version: v1.3.0
|
||||||
- src: stackhpc.os-networks
|
- src: stackhpc.os-networks
|
||||||
version: v1.3.1
|
version: v1.4.0
|
||||||
- src: stackhpc.os-openstackclient
|
- src: stackhpc.os-openstackclient
|
||||||
version: v1.3.0
|
version: v1.4.0
|
||||||
- src: stackhpc.os-shade
|
- src: stackhpc.os_openstacksdk
|
||||||
version: v1.3.0
|
version: v1.0.0
|
||||||
- src: yatesr.timezone
|
- src: yatesr.timezone
|
||||||
version: 1.2.0
|
version: 1.2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user