From 57f6e3204d7f1e05eca0b6c4db7ae4a066a8b1c9 Mon Sep 17 00:00:00 2001 From: SamYaple Date: Sat, 26 Dec 2015 01:22:00 +0000 Subject: [PATCH] Convert Nova to kolla_docker Change-Id: I0c6df8e7b732a37ff3cabff8d588f8b7d15df192 Partially-Implements: blueprint kolla-docker-module --- ansible/roles/nova/tasks/bootstrap.yml | 39 +--- ansible/roles/nova/tasks/start.yml | 249 +++++++------------------ 2 files changed, 77 insertions(+), 211 deletions(-) diff --git a/ansible/roles/nova/tasks/bootstrap.yml b/ansible/roles/nova/tasks/bootstrap.yml index 809b5e64ce..16e2500c59 100644 --- a/ansible/roles/nova/tasks/bootstrap.yml +++ b/ansible/roles/nova/tasks/bootstrap.yml @@ -36,40 +36,17 @@ delegate_to: "{{ groups['nova-api'][0] }}" - name: Starting Nova bootstrap container - docker: - tty: True + 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_nova - image: "{{ nova_api_image_full }}" - volumes: "{{ node_config_directory }}/nova-api/:{{ container_config_directory }}/:ro" - env: + environment: KOLLA_BOOTSTRAP: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" - run_once: True - delegate_to: "{{ groups['nova-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_nova - register: bootstrap_result - run_once: True - failed_when: bootstrap_result.stdout != "0" - delegate_to: "{{ groups['nova-api'][0] }}" - when: database_created - -- name: Cleaning up Nova bootstrap container - docker: - name: bootstrap_nova image: "{{ nova_api_image_full }}" - state: absent + name: "bootstrap_nova" + restart_policy: "never" + volumes: "{{ node_config_directory }}/nova-api/:{{ container_config_directory }}/:ro" + run_once: True delegate_to: "{{ groups['nova-api'][0] }}" when: database_created diff --git a/ansible/roles/nova/tasks/start.yml b/ansible/roles/nova/tasks/start.yml index cc0a6632e1..7024d81e43 100644 --- a/ansible/roles/nova/tasks/start.yml +++ b/ansible/roles/nova/tasks/start.yml @@ -1,256 +1,145 @@ --- -- name: Starting Nova 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: nova_data +- name: Starting nova-data container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_data_image_full }}" + name: "nova_data" volumes: - "/var/lib/nova/instances" - "/var/lib/libvirt" when: inventory_hostname in groups['compute'] -- name: Starting Nova-libvirt 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 }}" - privileged: True - pid: host - name: nova_libvirt +- name: Starting nova-libvirt container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_libvirt_image_full }}" + name: "nova_libvirt" + pid_mode: "host" + privileged: True volumes: - "{{ node_config_directory }}/nova-libvirt/:{{ container_config_directory }}/:ro" + - "/lib/modules:/lib/modules:ro" - "/run:/run" - "/sys/fs/cgroup:/sys/fs/cgroup" - - "/lib/modules:/lib/modules:ro" - volumes_from: - - nova_data - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + volumes_from: "nova_data" when: inventory_hostname in groups['compute'] -- name: Starting Nova-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 }}" - privileged: True - name: nova_api +- name: Starting nova-api container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_api_image_full }}" + name: "nova_api" + privileged: True volumes: - - "/var/lib/kolla/dev/log:/dev/log" - "{{ node_config_directory }}/nova-api/:{{ container_config_directory }}/:ro" - "/lib/modules:/lib/modules:ro" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + - "/var/lib/kolla/dev/log:/dev/log" when: inventory_hostname in groups['nova-api'] -- name: Starting Nova-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: nova_conductor +- name: Starting nova-conductor container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + name: "nova_conductor" image: "{{ nova_conductor_image_full }}" volumes: - - "/var/lib/kolla/dev/log:/dev/log" - "{{ node_config_directory }}/nova-conductor/:{{ container_config_directory }}/:ro" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + - "/var/lib/kolla/dev/log:/dev/log" when: inventory_hostname in groups['nova-conductor'] -- name: Starting Nova-consoleauth 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: nova_consoleauth +- name: Starting nova-consoleauth container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_consoleauth_image_full }}" + name: "nova_consoleauth" volumes: - - "/var/lib/kolla/dev/log:/dev/log" - "{{ node_config_directory }}/nova-consoleauth/:{{ container_config_directory }}/:ro" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + - "/var/lib/kolla/dev/log:/dev/log" when: inventory_hostname in groups['nova-consoleauth'] -- name: Starting Nova-novncproxy 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: nova_novncproxy +- name: Starting nova-novncproxy container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_novncproxy_image_full }}" + name: "nova_novncproxy" volumes: - - "/var/lib/kolla/dev/log:/dev/log" - "{{ node_config_directory }}/nova-novncproxy/:{{ container_config_directory }}/:ro" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + - "/var/lib/kolla/dev/log:/dev/log" when: - inventory_hostname in groups['nova-novncproxy'] - nova_console == 'novnc' -- name: Starting Nova-scheduler 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: nova_scheduler +- name: Starting nova-scheduler container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_scheduler_image_full }}" + name: "nova_scheduler" volumes: - - "/var/lib/kolla/dev/log:/dev/log" - "{{ node_config_directory }}/nova-scheduler/:{{ container_config_directory }}/:ro" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + - "/var/lib/kolla/dev/log:/dev/log" when: inventory_hostname in groups['nova-scheduler'] -- name: Starting Nova-spicehtml5proxy 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: nova_spicehtml5proxy +- name: Starting nova-spicehtml5proxy container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_spicehtml5proxy_image_full }}" + name: "nova_spicehtml5proxy" volumes: - - "/var/lib/kolla/dev/log:/dev/log" - "{{ node_config_directory }}/nova-spicehtml5proxy/:{{ container_config_directory }}/:ro" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + - "/var/lib/kolla/dev/log:/dev/log" when: - inventory_hostname in groups['nova-spicehtml5proxy'] - nova_console == 'spice' -- name: Starting Nova-compute 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 }}" - privileged: True - name: nova_compute +- name: Starting nova-compute container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_compute_image_full }}" + name: "nova_compute" + privileged: True volumes: - "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro" - "/lib/modules:/lib/modules:ro" - "/run:/run" - "/var/lib/kolla/dev/log:/dev/log" - volumes_from: - - nova_data - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + volumes_from: "nova_data" when: - inventory_hostname in groups['compute'] - not enable_nova_fake | bool -- name: Starting Nova-compute-ironic 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 }}" - privileged: True - name: nova_compute_ironic +- name: Starting nova-compute-ironic container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_compute_ironic_image_full }}" + name: "nova_compute_ironic" volumes: - "{{ node_config_directory }}/nova-compute-ironic/:{{ container_config_directory }}/:ro" - "/var/lib/kolla/dev/log:/dev/log" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" when: - inventory_hostname in groups['nova-compute-ironic'] - enable_ironic | bool -- name: Starting fake Nova-compute containers - 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 }}" - privileged: True - name: nova_compute_fake_{{ item }} +- name: Starting nova-compute-fake containers + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ nova_compute_image_full }}" + name: "nova_compute_fake_{{ item }}" + privileged: True volumes: - "{{ node_config_directory }}/nova-compute-fake-{{ item }}/:{{ container_config_directory }}/:ro" - "/lib/modules:/lib/modules:ro" - "/run:/run" - "/var/lib/kolla/dev/log:/dev/log" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" with_sequence: start=1 end={{ num_nova_fake_per_node }} when: - inventory_hostname in groups['compute']