5d022f1c66
After creating the octavia rsyslog configuration file, the
octavia_rsyslog container must be restarted if it's already running,
otherwise the new configuration is not applied in the container.
This issue is new, the octavia-ansible playbook was moved from step 5 to
post_deploy, which means that the file is now created after the first start
of the container.
Change-Id: Ibb439d47d551adc5af2d87234b732565af1cc90f
(cherry picked from commit 0a6f775201
)
175 lines
4.8 KiB
YAML
175 lines
4.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: configure amphora log offloading
|
|
block:
|
|
- name: create ip list (rsyslog)
|
|
set_fact:
|
|
o_rsyslog_ip_list: "{% for octavia_node in groups['octavia_nodes'] %}{{ hostvars[octavia_node].mgmt_port_ip }}:514, {%endfor%}"
|
|
|
|
- name: create ip list (remove the last two characters) (rsyslog)
|
|
set_fact:
|
|
o_rsyslog_ip_list: "{{ o_rsyslog_ip_list[:-2] }}"
|
|
|
|
- name: create /etc/rsyslog.d
|
|
become: true
|
|
become_user: root
|
|
file:
|
|
state: directory
|
|
path: "{{ octavia_confd_prefix }}/etc/rsyslog.d"
|
|
selevel: s0
|
|
setype: svirt_sandbox_file_t
|
|
|
|
- name: create rsyslog 10-octavia.conf
|
|
become: true
|
|
become_user: root
|
|
template:
|
|
src: templates/10-octavia.conf.j2
|
|
dest: "{{ octavia_confd_prefix }}/etc/rsyslog.d/10-octavia.conf"
|
|
selevel: s0
|
|
setype: svirt_sandbox_file_t
|
|
|
|
- name: check if octavia rsyslog is running
|
|
become: true
|
|
become_user: root
|
|
shell: |
|
|
systemctl is-active --quiet tripleo_octavia_rsyslog
|
|
failed_when: false
|
|
register: octavia_rsyslog_service
|
|
|
|
- name: restart octavia rsyslog service
|
|
become: true
|
|
become_user: root
|
|
systemd:
|
|
name: tripleo_octavia_rsyslog
|
|
state: restarted
|
|
when:
|
|
- octavia_rsyslog_service.rc == 0
|
|
when: enable_log_offloading | bool
|
|
|
|
- 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
|
|
|
|
- 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: setting [amphora_agent]/tenant_log_targets
|
|
become: true
|
|
become_user: root
|
|
ini_file:
|
|
section: "amphora_agent"
|
|
option: "tenant_log_targets"
|
|
value: "{{ o_rsyslog_ip_list }}"
|
|
path: "{{ octavia_confd_prefix }}/etc/octavia/post-deploy.conf"
|
|
selevel: s0
|
|
setype: svirt_sandbox_file_t
|
|
when:
|
|
- enable_log_offloading | bool
|
|
|
|
- name: setting [amphora_agent]/admin_log_targets
|
|
become: true
|
|
become_user: root
|
|
ini_file:
|
|
section: "amphora_agent"
|
|
option: "admin_log_targets"
|
|
value: "{{ o_rsyslog_ip_list }}"
|
|
path: "{{ octavia_confd_prefix }}/etc/octavia/post-deploy.conf"
|
|
selevel: s0
|
|
setype: svirt_sandbox_file_t
|
|
when:
|
|
- enable_log_offloading | bool
|
|
|
|
- name: get list of running octavia services
|
|
become: true
|
|
become_user: root
|
|
shell: |
|
|
systemctl is-active --quiet {{ item }} && echo {{ item }}
|
|
failed_when: false
|
|
register: octavia_active_services
|
|
loop:
|
|
- tripleo_octavia_api
|
|
- tripleo_octavia_worker
|
|
- tripleo_octavia_health_manager
|
|
- tripleo_octavia_housekeeping
|
|
- tripleo_octavia_driver_agent
|
|
when:
|
|
- container_cli == "podman"
|
|
- octavia_config_updated
|
|
|
|
- name: restart octavia services
|
|
become: true
|
|
become_user: root
|
|
systemd:
|
|
name: "{{ item.stdout }}"
|
|
state: restarted
|
|
loop: "{{ octavia_active_services.results }}"
|
|
when:
|
|
- container_cli == "podman"
|
|
- octavia_config_updated
|
|
- item.rc == 0
|
|
|
|
- name: get list of running octavia containers
|
|
become: true
|
|
become_user: root
|
|
shell: |
|
|
"{{ container_cli }}" ps -f name=octavia -q
|
|
register: running_octavia_containers
|
|
when:
|
|
- container_cli == "docker"
|
|
- octavia_config_updated
|
|
|
|
- name: restart octavia containers
|
|
become: true
|
|
become_user: root
|
|
shell: "{{ container_cli }} restart {{ running_octavia_containers.stdout_lines|join(' ') }}"
|
|
when:
|
|
- container_cli == "docker"
|
|
- octavia_config_updated
|
|
- (running_octavia_containers.stdout|length) > 0
|
|
|
|
- name: remove directory /etc/octavia/conf.d/common (LP#1836074)
|
|
file:
|
|
path: "{{ octavia_confd_prefix }}/etc/octavia/conf.d/common"
|
|
state: absent
|