diff --git a/ansible/roles/glance/tasks/bootstrap.yml b/ansible/roles/glance/tasks/bootstrap.yml index 6d29fec4bf..bb1b30a6df 100644 --- a/ansible/roles/glance/tasks/bootstrap.yml +++ b/ansible/roles/glance/tasks/bootstrap.yml @@ -36,41 +36,18 @@ run_once: True delegate_to: "{{ groups['glance-api'][0] }}" -- name: Starting Glance bootstrap container - docker: - tty: True +- name: Running Glance 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_glance - image: "{{ glance_api_image_full }}" - volumes: "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro" - env: + environment: KOLLA_BOOTSTRAP: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" - run_once: True - delegate_to: "{{ groups['glance-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_glance - register: bootstrap_result - run_once: True - delegate_to: "{{ groups['glance-api'][0] }}" - failed_when: bootstrap_result.stdout != "0" - when: database_created - -- name: Cleaning up Glance bootstrap container - docker: - name: bootstrap_glance image: "{{ glance_api_image_full }}" - state: absent + name: "bootstrap_glance" + restart_policy: "never" + volumes: "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro" + run_once: True delegate_to: "{{ groups['glance-api'][0] }}" when: database_created diff --git a/ansible/roles/glance/tasks/start.yml b/ansible/roles/glance/tasks/start.yml index 89c64b8d6f..013a1359d0 100644 --- a/ansible/roles/glance/tasks/start.yml +++ b/ansible/roles/glance/tasks/start.yml @@ -1,60 +1,31 @@ --- -- name: Starting Glance data 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: glance_data +- name: Starting glance-data container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ glance_data_image_full }}" + name: "glance_data" volumes: "/var/lib/glance/" -- name: Starting Glance-registry 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: glance_registry +- name: Starting glance-registry container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ glance_registry_image_full }}" + name: "glance_registry" volumes: - "{{ node_config_directory }}/glance-registry/:{{ container_config_directory }}/:ro" - "/var/lib/kolla/dev/log:/dev/log" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" when: inventory_hostname in groups['glance-registry'] -- name: Starting Glance-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: glance_api +- name: Starting glance-api container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ glance_api_image_full }}" + name: "glance_api" volumes: - "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro" - "/var/lib/kolla/dev/log:/dev/log" - volumes_from: - - glance_data - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + volumes_from: "glance_data" when: inventory_hostname in groups['glance-api']