Merge "Optimize reconfiguration for ironic"

This commit is contained in:
Zuul 2018-03-23 09:55:36 +00:00 committed by Gerrit Code Review
commit cc10ac0c22
10 changed files with 290 additions and 240 deletions

View File

@ -1,6 +1,63 @@
--- ---
project_name: "ironic" project_name: "ironic"
ironic_services:
ironic-api:
container_name: ironic_api
group: ironic-api
enabled: true
image: "{{ ironic_api_image_full }}"
volumes:
- "{{ node_config_directory }}/ironic-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla"
ironic-conductor:
container_name: ironic_conductor
group: ironic-conductor
enabled: true
image: "{{ ironic_conductor_image_full }}"
privileged: True
volumes:
- "{{ node_config_directory }}/ironic-conductor/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "/lib/modules:/lib/modules:ro"
- "/sys:/sys"
- "/dev:/dev"
- "/run:/run:shared"
- "kolla_logs:/var/log/kolla"
- "ironic:/var/lib/ironic"
- "ironic_pxe:/tftpboot/"
ironic-inspector:
container_name: ironic_inspector
group: ironic-inspector
enabled: true
image: "{{ ironic_inspector_image_full }}"
privileged: True
volumes:
- "{{ node_config_directory }}/ironic-inspector/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla"
ironic-pxe:
container_name: ironic_pxe
group: ironic-pxe
enabled: true
image: "{{ ironic_pxe_image_full }}"
volumes:
- "{{ node_config_directory }}/ironic-pxe/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "ironic_pxe:/tftpboot/"
- "kolla_logs:/var/log/kolla"
ironic-dnsmasq:
container_name: ironic_dnsmasq
group: ironic-inspector
enabled: true
image: "{{ ironic_dnsmasq_image_full }}"
volumes:
- "{{ node_config_directory }}/ironic-dnsmasq/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla"
#################### ####################
# Database # Database
#################### ####################

View File

@ -0,0 +1,112 @@
---
- name: Restart ironic-api container
vars:
service_name: "ironic-api"
service: "{{ ironic_services[service_name] }}"
config_json: "{{ ironic_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
ironic_conf: "{{ ironic_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_json: "{{ ironic_policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
ironic_api_container: "{{ check_ironic_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
when:
- action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or ironic_conf.changed | bool
or policy_json.changed | bool
or ironic_api_container.changed | bool
- name: Restart ironic-conductor container
vars:
service_name: "ironic-conductor"
service: "{{ ironic_services[service_name] }}"
config_json: "{{ ironic_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
ironic_conf: "{{ ironic_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_json: "{{ ironic_policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
ironic_conductor_container: "{{ check_ironic_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes }}"
when:
- action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or ironic_conf.changed | bool
or policy_json.changed | bool
or ironic_conductor_container.changed | bool
- name: Restart ironic-inspector container
vars:
service_name: "ironic-inspector"
service: "{{ ironic_services[service_name] }}"
config_json: "{{ ironic_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_json: "{{ ironic_policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
ironic_inspector_container: "{{ check_ironic_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes }}"
when:
- action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or ironic_inspector_confs.changed | bool
or policy_json.changed | bool
or ironic_inspector_container.changed | bool
- name: Restart ironic-pxe container
vars:
service_name: "ironic-pxe"
service: "{{ ironic_services[service_name] }}"
config_json: "{{ ironic_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
ironic_pxe_container: "{{ check_ironic_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
when:
- action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or ironic_pxe_confs.changed | bool
or ironic_pxe_uefi_confs.changed | bool
or ironic_kernel.changed | bool
or ironic_pxe_container.changed | bool
- name: Restart ironic-dnsmasq container
vars:
service_name: "ironic-dnsmasq"
service: "{{ ironic_services[service_name] }}"
config_json: "{{ ironic_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
ironic_dnsmasq_container: "{{ check_ironic_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
when:
- action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or ironic_dnsmasq_confs.changed | bool
or ironic_dnsmasq_container.changed | bool

View File

@ -52,6 +52,8 @@
when: database.changed when: database.changed
- name: Running Ironic-PXE bootstrap container - name: Running Ironic-PXE bootstrap container
vars:
ironic_pxe: "{{ ironic_services['ironic-pxe'] }}"
kolla_docker: kolla_docker:
action: "start_container" action: "start_container"
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
@ -59,13 +61,10 @@
environment: environment:
KOLLA_BOOTSTRAP: KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ ironic_pxe_image_full }}" image: "{{ ironic_pxe.image }}"
labels: labels:
BOOTSTRAP: BOOTSTRAP:
name: "bootstrap_ironic_pxe" name: "bootstrap_ironic_pxe"
restart_policy: "never" restart_policy: "never"
volumes: volumes: "{{ ironic_pxe.volumes }}"
- "{{ node_config_directory }}/ironic-pxe/:{{ container_config_directory }}/:ro" when: inventory_hostname in groups[ironic_pxe.group]
- "/etc/localtime:/etc/localtime:ro"
- "ironic_pxe:/tftpboot/"
when: inventory_hostname in groups['ironic-pxe']

View File

@ -1,5 +1,7 @@
--- ---
- name: Running Ironic bootstrap container - name: Running Ironic bootstrap container
vars:
ironic_api: "{{ ironic_services['ironic-api'] }}"
kolla_docker: kolla_docker:
action: "start_container" action: "start_container"
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
@ -7,19 +9,19 @@
environment: environment:
KOLLA_BOOTSTRAP: KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ ironic_api_image_full }}" image: "{{ ironic_api.image }}"
labels: labels:
BOOTSTRAP: BOOTSTRAP:
name: "bootstrap_ironic" name: "bootstrap_ironic"
restart_policy: "never" restart_policy: "never"
volumes: volumes: "{{ ironic_api.volumes }}"
- "{{ node_config_directory }}/ironic-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
run_once: True run_once: True
delegate_to: "{{ groups['ironic-api'][0] }}" delegate_to: "{{ groups[ironic_api.group][0] }}"
when: inventory_hostname in groups['ironic-api'] when: inventory_hostname in groups[ironic_api.group]
- name: Running Ironic Inspector bootstrap container - name: Running Ironic Inspector bootstrap container
vars:
ironic_inspector: "{{ ironic_services['ironic-inspector'] }}"
kolla_docker: kolla_docker:
action: "start_container" action: "start_container"
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
@ -27,14 +29,12 @@
environment: environment:
KOLLA_BOOTSTRAP: KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ ironic_inspector_image_full }}" image: "{{ ironic_inspector.image }}"
labels: labels:
BOOTSTRAP: BOOTSTRAP:
name: "bootstrap_ironic_inspector" name: "bootstrap_ironic_inspector"
restart_policy: "never" restart_policy: "never"
volumes: volumes: "{{ ironic_inspector.volumes }}"
- "{{ node_config_directory }}/ironic-inspector/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
run_once: True run_once: True
delegate_to: "{{ groups['ironic-inspector'][0] }}" delegate_to: "{{ groups[ironic_inspector.group][0] }}"
when: inventory_hostname in groups['ironic-inspector'] when: inventory_hostname in groups[ironic_inspector.group]

View File

@ -1,18 +1,16 @@
--- ---
- name: Ensuring config directories exist - name: Ensuring config directories exist
file: file:
path: "{{ node_config_directory }}/{{ item }}" path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory" state: "directory"
owner: "{{ config_owner_user }}" owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}" group: "{{ config_owner_group }}"
mode: "0770" mode: "0770"
become: true become: true
with_items: when:
- "ironic-api" - inventory_hostname in groups[item.value.group]
- "ironic-conductor" - item.value.enabled | bool
- "ironic-inspector" with_dict: "{{ ironic_services }}"
- "ironic-pxe"
- "ironic-dnsmasq"
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ item }}" local_action: stat path="{{ item }}"
@ -33,37 +31,43 @@
- name: Copying over config.json files for services - name: Copying over config.json files for services
template: template:
src: "{{ item }}.json.j2" src: "{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ item }}/config.json" dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
mode: "0660" mode: "0660"
become: true become: true
with_items: register: ironic_config_jsons
- "ironic-api" when:
- "ironic-conductor" - inventory_hostname in groups[item.value.group]
- "ironic-inspector" - item.value.enabled | bool
- "ironic-pxe" with_dict: "{{ ironic_services }}"
- "ironic-dnsmasq" notify:
- "Restart {{ item.key }} container"
- name: Copying over ironic.conf - name: Copying over ironic.conf
vars: vars:
service_name: "{{ item }}" service_name: "{{ item.key }}"
merge_configs: merge_configs:
sources: sources:
- "{{ role_path }}/templates/ironic.conf.j2" - "{{ role_path }}/templates/ironic.conf.j2"
- "{{ node_custom_config }}/global.conf" - "{{ node_custom_config }}/global.conf"
- "{{ node_custom_config }}/ironic.conf" - "{{ node_custom_config }}/ironic.conf"
- "{{ node_custom_config }}/ironic/{{ item }}.conf" - "{{ node_custom_config }}/ironic/{{ item.key }}.conf"
- "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic.conf" - "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic.conf"
dest: "{{ node_config_directory }}/{{ item }}/ironic.conf" dest: "{{ node_config_directory }}/{{ item.key }}/ironic.conf"
mode: "0660" mode: "0660"
become: true become: true
with_items: register: ironic_confs
- "ironic-api" when:
- "ironic-conductor" - item.key in [ "ironic-api", "ironic-conductor" ]
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ironic_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Copying over inspector.conf - name: Copying over inspector.conf
vars: vars:
service_name: "ironic-inspector" service: "{{ ironic_services['ironic-inspector'] }}"
merge_configs: merge_configs:
sources: sources:
- "{{ role_path }}/templates/ironic-inspector.conf.j2" - "{{ role_path }}/templates/ironic-inspector.conf.j2"
@ -74,26 +78,41 @@
dest: "{{ node_config_directory }}/ironic-inspector/inspector.conf" dest: "{{ node_config_directory }}/ironic-inspector/inspector.conf"
mode: "0660" mode: "0660"
become: true become: true
when: inventory_hostname in groups['ironic-inspector'] register: ironic_inspector_confs
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart ironic-inspector container
- name: Copying over dnsmasq.conf - name: Copying over dnsmasq.conf
vars:
service: "{{ ironic_services['ironic-dnsmasq'] }}"
template: template:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ node_config_directory }}/ironic-dnsmasq/dnsmasq.conf" dest: "{{ node_config_directory }}/ironic-dnsmasq/dnsmasq.conf"
mode: "0660" mode: "0660"
become: true become: true
register: ironic_dnsmasq_confs
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_first_found: with_first_found:
- "{{ node_custom_config }}/ironic/ironic-dnsmasq.conf" - "{{ node_custom_config }}/ironic/ironic-dnsmasq.conf"
- "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic-dnsmasq.conf" - "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic-dnsmasq.conf"
- "ironic-dnsmasq.conf.j2" - "ironic-dnsmasq.conf.j2"
when: inventory_hostname in groups['ironic-inspector'] notify:
- Restart ironic-dnsmasq container
- name: Copying pxelinux.cfg default - name: Copying pxelinux.cfg default
vars:
service: "{{ ironic_services['ironic-pxe'] }}"
template: template:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ node_config_directory }}/ironic-pxe/default" dest: "{{ node_config_directory }}/ironic-pxe/default"
mode: "0660" mode: "0660"
become: true become: true
register: ironic_pxe_confs
with_first_found: with_first_found:
- "{{ node_custom_config }}/ironic/pxelinux.default" - "{{ node_custom_config }}/ironic/pxelinux.default"
- "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/pxelinux.default" - "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/pxelinux.default"
@ -101,29 +120,41 @@
when: when:
# Only required when Ironic inspector is in use. # Only required when Ironic inspector is in use.
- groups['ironic-inspector'] | length > 0 - groups['ironic-inspector'] | length > 0
- inventory_hostname in groups['ironic-pxe'] - inventory_hostname in groups[service.group]
- service.enabled | bool
- not enable_ironic_pxe_uefi | bool - not enable_ironic_pxe_uefi | bool
notify:
- Restart ironic-pxe container
- name: Copying ironic_pxe_uefi.cfg default - name: Copying ironic_pxe_uefi.cfg default
vars:
service: "{{ ironic_services['ironic-pxe'] }}"
template: template:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ node_config_directory }}/ironic-pxe/default" dest: "{{ node_config_directory }}/ironic-pxe/default"
mode: "0660" mode: "0660"
become: true become: true
register: ironic_pxe_uefi_confs
with_first_found: with_first_found:
- "{{ node_custom_config }}/ironic/ironic_pxe_uefi.default" - "{{ node_custom_config }}/ironic/ironic_pxe_uefi.default"
- "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic_pxe_uefi.default" - "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic_pxe_uefi.default"
- "ironic_pxe_uefi.default.j2" - "ironic_pxe_uefi.default.j2"
when: when:
- inventory_hostname in groups['ironic-pxe'] - inventory_hostname in groups[service.group]
- service.enabled | bool
- enable_ironic_pxe_uefi | bool - enable_ironic_pxe_uefi | bool
notify:
- Restart ironic-pxe container
- name: Copying ironic-agent kernel and initramfs - name: Copying ironic-agent kernel and initramfs
vars:
service: "{{ ironic_services['ironic-pxe'] }}"
copy: copy:
src: "{{ node_custom_config }}/ironic/{{ item }}" src: "{{ node_custom_config }}/ironic/{{ item }}"
dest: "{{ node_config_directory }}/ironic-pxe/{{ item }}" dest: "{{ node_config_directory }}/ironic-pxe/{{ item }}"
mode: "0660" mode: "0660"
become: true become: true
register: ironic_kernel
with_items: with_items:
- "ironic-agent.kernel" - "ironic-agent.kernel"
- "ironic-agent.initramfs" - "ironic-agent.initramfs"
@ -131,18 +162,46 @@
# Only required when Ironic inspector is in use. # Only required when Ironic inspector is in use.
- groups['ironic-inspector'] | length > 0 - groups['ironic-inspector'] | length > 0
- inventory_hostname in groups['ironic-pxe'] - inventory_hostname in groups['ironic-pxe']
- inventory_hostname in groups[service.group]
- service.enabled | bool
- not enable_ironic_pxe_uefi | bool - not enable_ironic_pxe_uefi | bool
notify:
- Restart ironic-pxe container
- name: Copying over existing policy file - name: Copying over existing policy file
vars:
services_require_policy_json:
- ironic-api
- ironic-conductor
- ironic-inspector
template: template:
src: "{{ ironic_policy_file_path }}" src: "{{ ironic_policy_file_path }}"
dest: "{{ node_config_directory }}/{{ item }}/{{ ironic_policy_file }}" dest: "{{ node_config_directory }}/{{ item.key }}/{{ ironic_policy_file }}"
mode: "0770" mode: "0770"
become: true become: true
with_items: register: ironic_policy_jsons
- "ironic-api"
- "ironic-conductor"
- "ironic-inspector"
- "ironic-pxe"
when: when:
ironic_policy_file is defined - ironic_policy_file is defined
- item.key in services_require_policy_json
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ironic_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Check ironic containers
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
privileged: "{{ item.value.privileged|default(False) }}"
volumes: "{{ item.value.volumes }}"
register: check_ironic_containers
when:
- action != "config"
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ironic_services }}"
notify:
- "Restart {{ item.key }} container"

View File

@ -12,10 +12,8 @@
- include: bootstrap.yml - include: bootstrap.yml
when: inventory_hostname in groups['ironic-api'] or when: inventory_hostname in groups['ironic-api'] or
inventory_hostname in groups['ironic-inspector']
- include: start.yml
when: inventory_hostname in groups['ironic-api'] or
inventory_hostname in groups['ironic-conductor'] or
inventory_hostname in groups['ironic-inspector'] or inventory_hostname in groups['ironic-inspector'] or
inventory_hostname in groups['ironic-pxe'] inventory_hostname in groups['ironic-pxe']
- name: Flush handlers
meta: flush_handlers

View File

@ -1,35 +1,10 @@
--- ---
- name: Pulling ironic-api image - name: Pulling ironic images
kolla_docker: kolla_docker:
action: "pull_image" action: "pull_image"
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
image: "{{ ironic_api_image_full }}" image: "{{ item.value.image }}"
when: inventory_hostname in groups['ironic-api'] when:
- inventory_hostname in groups[item.value.group]
- name: Pulling ironic-conductor image - item.value.enabled | bool
kolla_docker: with_dict: "{{ ironic_services }}"
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ ironic_conductor_image_full }}"
when: inventory_hostname in groups['ironic-conductor']
- name: Pulling ironic-dnsmasq image
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ ironic_dnsmasq_image_full }}"
when: inventory_hostname in groups['ironic-inspector']
- name: Pulling ironic-inspector image
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ ironic_inspector_image_full }}"
when: inventory_hostname in groups['ironic-inspector']
- name: Pulling ironic-pxe image
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ ironic_pxe_image_full }}"
when: inventory_hostname in groups['ironic-pxe']

View File

@ -1,86 +1,2 @@
--- ---
- include: register.yml - include: deploy.yml
when: enable_keystone | bool and
(inventory_hostname in groups['ironic-api'] or
inventory_hostname in groups['ironic-inspector'])
- name: Ensuring the containers up
kolla_docker:
name: "{{ item.name }}"
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when: inventory_hostname in groups[item.group]
with_items:
- { name: ironic_pxe, group: ironic-pxe }
- { name: ironic_api, group: ironic-api }
- { name: ironic_conductor, group: ironic-conductor }
- { name: ironic_inspector, group: ironic-inspector }
- { name: ironic_dnsmasq, group: ironic-inspector }
- include: config.yml
- name: Check the configs
command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
register: check_results
when: inventory_hostname in groups[item.group]
with_items:
- { name: ironic_pxe, group: ironic-pxe }
- { name: ironic_api, group: ironic-api }
- { name: ironic_conductor, group: ironic-conductor }
- { name: ironic_inspector, group: ironic-inspector }
- { name: ironic_dnsmasq, group: ironic-inspector }
- name: Containers config strategy
kolla_docker:
name: "{{ item.name }}"
action: "get_container_env"
register: container_envs
when: inventory_hostname in groups[item.group]
with_items:
- { name: ironic_pxe, group: ironic-pxe }
- { name: ironic_api, group: ironic-api }
- { name: ironic_conductor, group: ironic-conductor }
- { name: ironic_inspector, group: ironic-inspector }
- { name: ironic_dnsmasq, group: ironic-inspector }
- name: Remove the containers
kolla_docker:
name: "{{ item[0]['name'] }}"
action: "remove_container"
register: remove_containers
when:
- inventory_hostname in groups[item[0]['group']]
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[2]['rc'] == 1
with_together:
- [{ name: ironic_pxe, group: ironic-pxe },
{ name: ironic_api, group: ironic-api },
{ name: ironic_conductor, group: ironic-conductor },
{ name: ironic_inspector, group: ironic-inspector },
{ name: ironic_dnsmasq, group: ironic-inspector }]
- "{{ container_envs.results }}"
- "{{ check_results.results }}"
- include: start.yml
when: remove_containers.changed
- name: Restart containers
kolla_docker:
name: "{{ item[0]['name'] }}"
action: "restart_container"
when:
- inventory_hostname in groups[item[0]['group']]
- config_strategy == 'COPY_ALWAYS'
- item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[2]['rc'] == 1
with_together:
- [{ name: ironic_pxe, group: ironic-pxe },
{ name: ironic_api, group: ironic-api },
{ name: ironic_conductor, group: ironic-conductor },
{ name: ironic_inspector, group: ironic-inspector },
{ name: ironic_dnsmasq, group: ironic-inspector }]
- "{{ container_envs.results }}"
- "{{ check_results.results }}"

View File

@ -1,67 +0,0 @@
---
- name: Starting ironic-pxe container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
name: "ironic_pxe"
image: "{{ ironic_pxe_image_full }}"
volumes:
- "{{ node_config_directory }}/ironic-pxe/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "ironic_pxe:/tftpboot/"
when: inventory_hostname in groups['ironic-pxe']
- name: Starting ironic-api container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ ironic_api_image_full }}"
name: "ironic_api"
volumes:
- "{{ node_config_directory }}/ironic-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla"
when: inventory_hostname in groups['ironic-api']
- name: Starting ironic-conductor container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ ironic_conductor_image_full }}"
name: "ironic_conductor"
privileged: True
volumes:
- "{{ node_config_directory }}/ironic-conductor/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "/lib/modules:/lib/modules:ro"
- "/sys:/sys"
- "/dev:/dev"
- "/run:/run:shared"
- "kolla_logs:/var/log/kolla"
- "ironic:/var/lib/ironic"
- "ironic_pxe:/tftpboot/"
when: inventory_hostname in groups['ironic-conductor']
- name: Starting ironic-inspector container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ ironic_inspector_image_full }}"
name: "ironic_inspector"
privileged: True
volumes:
- "{{ node_config_directory }}/ironic-inspector/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla"
when: inventory_hostname in groups['ironic-inspector']
- name: Starting ironic-dnsmasq container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ ironic_dnsmasq_image_full }}"
name: "ironic_dnsmasq"
volumes:
- "{{ node_config_directory }}/ironic-dnsmasq/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
when: inventory_hostname in groups['ironic-inspector']

View File

@ -8,4 +8,5 @@
- include: bootstrap_service.yml - include: bootstrap_service.yml
- include: start.yml - name: Flush handlers
meta: flush_handlers