replace openstackclient with ansible module

replace 'openstack aggregate create' command with ansible
os_nova_host_aggregate module and remove TODO

Change-Id: I727f9e4acc9e22f59735c65190ac38cc75e5f781
This commit is contained in:
wu.chunyang 2020-09-17 11:41:27 +08:00
parent b49c86848d
commit 0bb16b52f6

View File

@ -33,28 +33,16 @@
when:
- not use_preconfigured_databases | bool
# TODO(egonzalez) Use os_nova_host_aggregate ansible module once ansible min version is 2.3
# http://docs.ansible.com/ansible/os_nova_host_aggregate_module.html
- name: Creating blazar host aggregate
become: true
command: >
docker exec kolla_toolbox openstack
--os-interface internal
--os-auth-url {{ openstack_auth.auth_url }}
--os-identity-api-version 3
--os-project-domain-name {{ openstack_auth.domain_name }}
--os-project-name {{ openstack_auth.project_name }}
--os-username {{ openstack_auth.username }}
--os-password {{ openstack_auth.password }}
--os-user-domain-name {{ openstack_auth.user_domain_name }}
--os-region-name {{ openstack_region_name }}
{% if openstack_cacert != '' %}--os-cacert {{ openstack_cacert }}{% endif %}
aggregate create {{ blazar_aggregate_pool_name }}
register: blazar_host_aggregate
changed_when: blazar_host_aggregate is success
failed_when:
- blazar_host_aggregate.rc != 0
- blazar_host_aggregate.stderr.find('already') == -1
kolla_toolbox:
module_name: os_nova_host_aggregate
module_args:
auth: "{{ openstack_auth }}"
cacert: "{{ openstack_cacert }}"
endpoint_type: "{{ openstack_interface }}"
region_name: "{{ openstack_region_name }}"
name: "{{ blazar_aggregate_pool_name }}"
run_once: True
delegate_to: "{{ groups['blazar-api'][0] }}"