From 0bb16b52f62affb71d1ee2f931deed1af787a338 Mon Sep 17 00:00:00 2001 From: "wu.chunyang" Date: Thu, 17 Sep 2020 11:41:27 +0800 Subject: [PATCH] replace openstackclient with ansible module replace 'openstack aggregate create' command with ansible os_nova_host_aggregate module and remove TODO Change-Id: I727f9e4acc9e22f59735c65190ac38cc75e5f781 --- ansible/roles/blazar/tasks/bootstrap.yml | 28 +++++++----------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/ansible/roles/blazar/tasks/bootstrap.yml b/ansible/roles/blazar/tasks/bootstrap.yml index a0a09e580b..f6a24d6db6 100644 --- a/ansible/roles/blazar/tasks/bootstrap.yml +++ b/ansible/roles/blazar/tasks/bootstrap.yml @@ -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] }}"