diff --git a/ansible/roles/magnum/tasks/bootstrap.yml b/ansible/roles/magnum/tasks/bootstrap.yml index fda2352c59..e72df328b7 100644 --- a/ansible/roles/magnum/tasks/bootstrap.yml +++ b/ansible/roles/magnum/tasks/bootstrap.yml @@ -35,42 +35,18 @@ run_once: True delegate_to: "{{ groups['magnum-api'][0] }}" -- name: Starting Magnum bootstrap container - docker: - tty: True +- name: Running Magnum bootstrap container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" detach: False - net: host - pull: "{{ docker_pull_policy }}" - restart_policy: "no" - state: reloaded - registry: "{{ docker_registry }}" - username: "{{ docker_registry_username }}" - password: "{{ docker_registry_password }}" - insecure_registry: "{{ docker_insecure_registry }}" - name: bootstrap_magnum - image: "{{ magnum_api_image_full }}" - volumes: "{{ node_config_directory }}/magnum-api/:{{ container_config_directory }}/:ro" - env: + environment: KOLLA_BOOTSTRAP: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" - run_once: True - delegate_to: "{{ groups['magnum-api'][0] }}" - when: database_created - -# https://github.com/ansible/ansible-modules-core/pull/1031 -- name: Waiting for bootstrap container to exit - command: docker wait bootstrap_magnum - register: bootstrap_result - run_once: True - failed_when: bootstrap_result.stdout != "0" - delegate_to: "{{ groups['magnum-api'][0] }}" - when: database_created - -- name: Cleaning up Magnum boostrap container - docker: - tty: True - name: bootstrap_magnum image: "{{ magnum_api_image_full }}" - state: absent + name: "bootstrap_magnum" + restart_policy: "never" + volumes: "{{ node_config_directory }}/magnum-api/:{{ container_config_directory }}/:ro" + run_once: True delegate_to: "{{ groups['magnum-api'][0] }}" when: database_created diff --git a/ansible/roles/magnum/tasks/start.yml b/ansible/roles/magnum/tasks/start.yml index beba29e862..e103321eb6 100644 --- a/ansible/roles/magnum/tasks/start.yml +++ b/ansible/roles/magnum/tasks/start.yml @@ -1,42 +1,22 @@ --- - name: Starting magnum-api container - docker: - tty: True - net: host - pull: "{{ docker_pull_policy }}" - restart_policy: "{{ docker_restart_policy }}" - restart_policy_retry: "{{ docker_restart_policy_retry }}" - state: reloaded - registry: "{{ docker_registry }}" - username: "{{ docker_registry_username }}" - password: "{{ docker_registry_password }}" - insecure_registry: "{{ docker_insecure_registry }}" - name: magnum_api + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ magnum_api_image_full }}" + name: "magnum_api" volumes: - "{{ node_config_directory }}/magnum-api/:{{ container_config_directory }}/:ro" - "/var/lib/kolla/dev/log:/dev/log" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" when: inventory_hostname in groups['magnum-api'] - name: Starting magnum-conductor container - docker: - tty: True - net: host - pull: "{{ docker_pull_policy }}" - restart_policy: "{{ docker_restart_policy }}" - restart_policy_retry: "{{ docker_restart_policy_retry }}" - state: reloaded - registry: "{{ docker_registry }}" - username: "{{ docker_registry_username }}" - password: "{{ docker_registry_password }}" - insecure_registry: "{{ docker_insecure_registry }}" - name: magnum_conductor + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ magnum_conductor_image_full }}" + name: "magnum_conductor" volumes: - "{{ node_config_directory }}/magnum-conductor/:{{ container_config_directory }}/:ro" - "/var/lib/kolla/dev/log:/dev/log" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" when: inventory_hostname in groups['magnum-conductor']