63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
---
|
|
|
|
- name: Show debug information
|
|
debug:
|
|
msg: "Octavia services will be restarted because of updated configuration"
|
|
when:
|
|
- octavia_config_updated
|
|
|
|
- name: create ip list
|
|
set_fact:
|
|
o_hm_ip_list: "{% for octavia_node in groups['octavia_nodes'] %}{{ hostvars[octavia_node].o_hm_ip }}, {%endfor%}"
|
|
|
|
- name: create ip list (remove the last two characters)
|
|
set_fact:
|
|
o_hm_ip_list: "{{ o_hm_ip_list[:-2] }}"
|
|
|
|
- name: read the current IP list
|
|
become: true
|
|
become_user: root
|
|
shell: |
|
|
awk -F '=' -e '/^controller_ip_port_list/ { print $2; }' "{{ octavia_confd_prefix }}/etc/octavia/post-deploy.conf"
|
|
register: config_contents
|
|
failed_when: config_contents.rc != 0
|
|
changed_when: false
|
|
ignore_errors: true
|
|
|
|
- name: retrieve current ip list
|
|
set_fact:
|
|
current_ip_list: "{{ config_contents.stdout }}"
|
|
|
|
# This isn't perfect as they execution order will make them not match, but we can avoid a restart
|
|
# if things have stayed the same.
|
|
- name: check if ip list needs updating
|
|
set_fact:
|
|
octavia_config_updated: true
|
|
when:
|
|
- current_ip_list != o_hm_ip_list
|
|
|
|
- name: setting [health_manager]/controller_ip_port_list
|
|
become: true
|
|
become_user: root
|
|
ini_file:
|
|
section: "health_manager"
|
|
option: "controller_ip_port_list"
|
|
value: "{{ o_hm_ip_list }}"
|
|
path: "{{ octavia_confd_prefix }}/etc/octavia/post-deploy.conf"
|
|
selevel: s0
|
|
setype: svirt_sandbox_file_t
|
|
when:
|
|
- octavia_config_updated
|
|
|
|
- name: restart octavia containers
|
|
become: true
|
|
become_user: root
|
|
shell: "{{ container_cli }} restart $(sudo {{ container_cli }} ps -f name=octavia -q)"
|
|
when:
|
|
- octavia_config_updated
|
|
|
|
- name: remove directory /etc/octavia/conf.d/common (LP#1836074)
|
|
file:
|
|
path: "{{ octavia_confd_prefix }}/etc/octavia/conf.d/common"
|
|
state: absent
|