Merge "Optimize reconfiguration for ironic"
This commit is contained in:
commit
cc10ac0c22
@ -1,6 +1,63 @@
|
||||
---
|
||||
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
|
||||
####################
|
||||
|
112
ansible/roles/ironic/handlers/main.yml
Normal file
112
ansible/roles/ironic/handlers/main.yml
Normal 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
|
@ -52,6 +52,8 @@
|
||||
when: database.changed
|
||||
|
||||
- name: Running Ironic-PXE bootstrap container
|
||||
vars:
|
||||
ironic_pxe: "{{ ironic_services['ironic-pxe'] }}"
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
@ -59,13 +61,10 @@
|
||||
environment:
|
||||
KOLLA_BOOTSTRAP:
|
||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||
image: "{{ ironic_pxe_image_full }}"
|
||||
image: "{{ ironic_pxe.image }}"
|
||||
labels:
|
||||
BOOTSTRAP:
|
||||
name: "bootstrap_ironic_pxe"
|
||||
restart_policy: "never"
|
||||
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']
|
||||
volumes: "{{ ironic_pxe.volumes }}"
|
||||
when: inventory_hostname in groups[ironic_pxe.group]
|
||||
|
@ -1,5 +1,7 @@
|
||||
---
|
||||
- name: Running Ironic bootstrap container
|
||||
vars:
|
||||
ironic_api: "{{ ironic_services['ironic-api'] }}"
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
@ -7,19 +9,19 @@
|
||||
environment:
|
||||
KOLLA_BOOTSTRAP:
|
||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||
image: "{{ ironic_api_image_full }}"
|
||||
image: "{{ ironic_api.image }}"
|
||||
labels:
|
||||
BOOTSTRAP:
|
||||
name: "bootstrap_ironic"
|
||||
restart_policy: "never"
|
||||
volumes:
|
||||
- "{{ node_config_directory }}/ironic-api/:{{ container_config_directory }}/:ro"
|
||||
- "/etc/localtime:/etc/localtime:ro"
|
||||
volumes: "{{ ironic_api.volumes }}"
|
||||
run_once: True
|
||||
delegate_to: "{{ groups['ironic-api'][0] }}"
|
||||
when: inventory_hostname in groups['ironic-api']
|
||||
delegate_to: "{{ groups[ironic_api.group][0] }}"
|
||||
when: inventory_hostname in groups[ironic_api.group]
|
||||
|
||||
- name: Running Ironic Inspector bootstrap container
|
||||
vars:
|
||||
ironic_inspector: "{{ ironic_services['ironic-inspector'] }}"
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
@ -27,14 +29,12 @@
|
||||
environment:
|
||||
KOLLA_BOOTSTRAP:
|
||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||
image: "{{ ironic_inspector_image_full }}"
|
||||
image: "{{ ironic_inspector.image }}"
|
||||
labels:
|
||||
BOOTSTRAP:
|
||||
name: "bootstrap_ironic_inspector"
|
||||
restart_policy: "never"
|
||||
volumes:
|
||||
- "{{ node_config_directory }}/ironic-inspector/:{{ container_config_directory }}/:ro"
|
||||
- "/etc/localtime:/etc/localtime:ro"
|
||||
volumes: "{{ ironic_inspector.volumes }}"
|
||||
run_once: True
|
||||
delegate_to: "{{ groups['ironic-inspector'][0] }}"
|
||||
when: inventory_hostname in groups['ironic-inspector']
|
||||
delegate_to: "{{ groups[ironic_inspector.group][0] }}"
|
||||
when: inventory_hostname in groups[ironic_inspector.group]
|
||||
|
@ -1,18 +1,16 @@
|
||||
---
|
||||
- name: Ensuring config directories exist
|
||||
file:
|
||||
path: "{{ node_config_directory }}/{{ item }}"
|
||||
path: "{{ node_config_directory }}/{{ item.key }}"
|
||||
state: "directory"
|
||||
owner: "{{ config_owner_user }}"
|
||||
group: "{{ config_owner_group }}"
|
||||
mode: "0770"
|
||||
become: true
|
||||
with_items:
|
||||
- "ironic-api"
|
||||
- "ironic-conductor"
|
||||
- "ironic-inspector"
|
||||
- "ironic-pxe"
|
||||
- "ironic-dnsmasq"
|
||||
when:
|
||||
- inventory_hostname in groups[item.value.group]
|
||||
- item.value.enabled | bool
|
||||
with_dict: "{{ ironic_services }}"
|
||||
|
||||
- name: Check if policies shall be overwritten
|
||||
local_action: stat path="{{ item }}"
|
||||
@ -33,37 +31,43 @@
|
||||
|
||||
- name: Copying over config.json files for services
|
||||
template:
|
||||
src: "{{ item }}.json.j2"
|
||||
dest: "{{ node_config_directory }}/{{ item }}/config.json"
|
||||
src: "{{ item.key }}.json.j2"
|
||||
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
|
||||
mode: "0660"
|
||||
become: true
|
||||
with_items:
|
||||
- "ironic-api"
|
||||
- "ironic-conductor"
|
||||
- "ironic-inspector"
|
||||
- "ironic-pxe"
|
||||
- "ironic-dnsmasq"
|
||||
register: ironic_config_jsons
|
||||
when:
|
||||
- inventory_hostname in groups[item.value.group]
|
||||
- item.value.enabled | bool
|
||||
with_dict: "{{ ironic_services }}"
|
||||
notify:
|
||||
- "Restart {{ item.key }} container"
|
||||
|
||||
- name: Copying over ironic.conf
|
||||
vars:
|
||||
service_name: "{{ item }}"
|
||||
service_name: "{{ item.key }}"
|
||||
merge_configs:
|
||||
sources:
|
||||
- "{{ role_path }}/templates/ironic.conf.j2"
|
||||
- "{{ node_custom_config }}/global.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"
|
||||
dest: "{{ node_config_directory }}/{{ item }}/ironic.conf"
|
||||
dest: "{{ node_config_directory }}/{{ item.key }}/ironic.conf"
|
||||
mode: "0660"
|
||||
become: true
|
||||
with_items:
|
||||
- "ironic-api"
|
||||
- "ironic-conductor"
|
||||
register: ironic_confs
|
||||
when:
|
||||
- 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
|
||||
vars:
|
||||
service_name: "ironic-inspector"
|
||||
service: "{{ ironic_services['ironic-inspector'] }}"
|
||||
merge_configs:
|
||||
sources:
|
||||
- "{{ role_path }}/templates/ironic-inspector.conf.j2"
|
||||
@ -74,26 +78,41 @@
|
||||
dest: "{{ node_config_directory }}/ironic-inspector/inspector.conf"
|
||||
mode: "0660"
|
||||
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
|
||||
vars:
|
||||
service: "{{ ironic_services['ironic-dnsmasq'] }}"
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ node_config_directory }}/ironic-dnsmasq/dnsmasq.conf"
|
||||
mode: "0660"
|
||||
become: true
|
||||
register: ironic_dnsmasq_confs
|
||||
when:
|
||||
- inventory_hostname in groups[service.group]
|
||||
- service.enabled | bool
|
||||
with_first_found:
|
||||
- "{{ node_custom_config }}/ironic/ironic-dnsmasq.conf"
|
||||
- "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic-dnsmasq.conf"
|
||||
- "ironic-dnsmasq.conf.j2"
|
||||
when: inventory_hostname in groups['ironic-inspector']
|
||||
notify:
|
||||
- Restart ironic-dnsmasq container
|
||||
|
||||
- name: Copying pxelinux.cfg default
|
||||
vars:
|
||||
service: "{{ ironic_services['ironic-pxe'] }}"
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ node_config_directory }}/ironic-pxe/default"
|
||||
mode: "0660"
|
||||
become: true
|
||||
register: ironic_pxe_confs
|
||||
with_first_found:
|
||||
- "{{ node_custom_config }}/ironic/pxelinux.default"
|
||||
- "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/pxelinux.default"
|
||||
@ -101,29 +120,41 @@
|
||||
when:
|
||||
# Only required when Ironic inspector is in use.
|
||||
- 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
|
||||
notify:
|
||||
- Restart ironic-pxe container
|
||||
|
||||
- name: Copying ironic_pxe_uefi.cfg default
|
||||
vars:
|
||||
service: "{{ ironic_services['ironic-pxe'] }}"
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ node_config_directory }}/ironic-pxe/default"
|
||||
mode: "0660"
|
||||
become: true
|
||||
register: ironic_pxe_uefi_confs
|
||||
with_first_found:
|
||||
- "{{ node_custom_config }}/ironic/ironic_pxe_uefi.default"
|
||||
- "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic_pxe_uefi.default"
|
||||
- "ironic_pxe_uefi.default.j2"
|
||||
when:
|
||||
- inventory_hostname in groups['ironic-pxe']
|
||||
- inventory_hostname in groups[service.group]
|
||||
- service.enabled | bool
|
||||
- enable_ironic_pxe_uefi | bool
|
||||
notify:
|
||||
- Restart ironic-pxe container
|
||||
|
||||
- name: Copying ironic-agent kernel and initramfs
|
||||
vars:
|
||||
service: "{{ ironic_services['ironic-pxe'] }}"
|
||||
copy:
|
||||
src: "{{ node_custom_config }}/ironic/{{ item }}"
|
||||
dest: "{{ node_config_directory }}/ironic-pxe/{{ item }}"
|
||||
mode: "0660"
|
||||
become: true
|
||||
register: ironic_kernel
|
||||
with_items:
|
||||
- "ironic-agent.kernel"
|
||||
- "ironic-agent.initramfs"
|
||||
@ -131,18 +162,46 @@
|
||||
# Only required when Ironic inspector is in use.
|
||||
- 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
|
||||
notify:
|
||||
- Restart ironic-pxe container
|
||||
|
||||
- name: Copying over existing policy file
|
||||
vars:
|
||||
services_require_policy_json:
|
||||
- ironic-api
|
||||
- ironic-conductor
|
||||
- ironic-inspector
|
||||
template:
|
||||
src: "{{ ironic_policy_file_path }}"
|
||||
dest: "{{ node_config_directory }}/{{ item }}/{{ ironic_policy_file }}"
|
||||
dest: "{{ node_config_directory }}/{{ item.key }}/{{ ironic_policy_file }}"
|
||||
mode: "0770"
|
||||
become: true
|
||||
with_items:
|
||||
- "ironic-api"
|
||||
- "ironic-conductor"
|
||||
- "ironic-inspector"
|
||||
- "ironic-pxe"
|
||||
register: ironic_policy_jsons
|
||||
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"
|
||||
|
@ -12,10 +12,8 @@
|
||||
|
||||
- include: bootstrap.yml
|
||||
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-pxe']
|
||||
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
@ -1,35 +1,10 @@
|
||||
---
|
||||
- name: Pulling ironic-api image
|
||||
- name: Pulling ironic images
|
||||
kolla_docker:
|
||||
action: "pull_image"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
image: "{{ ironic_api_image_full }}"
|
||||
when: inventory_hostname in groups['ironic-api']
|
||||
|
||||
- name: Pulling ironic-conductor image
|
||||
kolla_docker:
|
||||
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']
|
||||
image: "{{ item.value.image }}"
|
||||
when:
|
||||
- inventory_hostname in groups[item.value.group]
|
||||
- item.value.enabled | bool
|
||||
with_dict: "{{ ironic_services }}"
|
||||
|
@ -1,86 +1,2 @@
|
||||
---
|
||||
- include: register.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 }}"
|
||||
- include: deploy.yml
|
||||
|
@ -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']
|
@ -8,4 +8,5 @@
|
||||
|
||||
- include: bootstrap_service.yml
|
||||
|
||||
- include: start.yml
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
Loading…
Reference in New Issue
Block a user