ade5bfa302
By default, Ansible injects a variable for every fact, prefixed with ansible_. This can result in a large number of variables for each host, which at scale can incur a performance penalty. Ansible provides a configuration option [0] that can be set to False to prevent this injection of facts. In this case, facts should be referenced via ansible_facts.<fact>. This change updates all references to Ansible facts within Kolla Ansible from using individual fact variables to using the items in the ansible_facts dictionary. This allows users to disable fact variable injection in their Ansible configuration, which may provide some performance improvement. This change disables fact variable injection in the ansible configuration used in CI, to catch any attempts to use the injected variables. [0] https://docs.ansible.com/ansible/latest/reference_appendices/config.html#inject-facts-as-vars Change-Id: I7e9d5c9b8b9164d4aee3abb4e37c8f28d98ff5d1 Partially-Implements: blueprint performance-improvements
100 lines
3.5 KiB
YAML
100 lines
3.5 KiB
YAML
---
|
|
- name: Create ports for Octavia health-manager nodes
|
|
become: true
|
|
kolla_toolbox:
|
|
module_name: os_port
|
|
module_args:
|
|
auth: "{{ octavia_user_auth }}"
|
|
cacert: "{{ openstack_cacert }}"
|
|
endpoint_type: "{{ openstack_interface }}"
|
|
region_name: "{{ openstack_region_name }}"
|
|
state: present
|
|
network: "{{ octavia_amp_network['name'] }}"
|
|
security_groups: "{{ octavia_amp_security_groups['health-mgr-sec-grp']['name'] }}"
|
|
device_owner: 'Octavia:health-mgr'
|
|
name: "octavia-listen-port-{{ ansible_facts.nodename }}"
|
|
register: port_info
|
|
|
|
# ansible os_port module does not support 'host' parameter, but we need set the port's host
|
|
# value to {{ ansible_facts.nodename }}, once os_port support this parameter, remove the task below
|
|
# https://docs.ansible.com/ansible/latest/modules/os_port_module.html#parameters
|
|
- name: Update Octavia health manager port host_id
|
|
become: True
|
|
vars:
|
|
port_id: "{{ port_info.id }}"
|
|
command: >
|
|
docker exec kolla_toolbox openstack
|
|
--os-interface {{ openstack_interface }}
|
|
--os-auth-url {{ octavia_user_auth.auth_url }}
|
|
--os-identity-api-version 3
|
|
--os-project-domain-name {{ octavia_user_auth.domain_name }}
|
|
--os-project-name {{ octavia_user_auth.project_name }}
|
|
--os-region-name {{ openstack_region_name }}
|
|
--os-username {{ octavia_user_auth.username }}
|
|
--os-password {{ octavia_user_auth.password }}
|
|
{% if openstack_cacert != '' %}--os-cacert {{ openstack_cacert }} {% endif %}
|
|
port set --host {{ ansible_facts.nodename }} {{ port_id }}
|
|
when:
|
|
- port_info.changed
|
|
|
|
- name: Add Octavia port to openvswitch br-int
|
|
vars:
|
|
port_mac: "{{ port_info.port.mac_address }}"
|
|
port_id: "{{ port_info.id }}"
|
|
become: True
|
|
command: >
|
|
docker exec openvswitch_vswitchd ovs-vsctl --may-exist \
|
|
add-port br-int {{ octavia_network_interface }} \
|
|
-- set Interface {{ octavia_network_interface }} type=internal \
|
|
-- set Interface {{ octavia_network_interface }} external-ids:iface-status=active \
|
|
-- set Interface {{ octavia_network_interface }} external-ids:attached-mac={{ port_mac }} \
|
|
-- set Interface {{ octavia_network_interface }} external-ids:iface-id={{ port_id }} \
|
|
-- set Interface {{ octavia_network_interface }} external-ids:skip_cleanup=true
|
|
|
|
- name: Create octavia dhclient conf
|
|
become: true
|
|
copy:
|
|
content: |
|
|
request subnet-mask,broadcast-address,interface-mtu;
|
|
do-forward-updates false;
|
|
dest: /etc/dhcp/octavia-dhclient.conf
|
|
mode: 0664
|
|
|
|
- name: Create octavia-interface service
|
|
become: True
|
|
template:
|
|
src: octavia-interface.service.j2
|
|
dest: /etc/systemd/system/octavia-interface.service
|
|
register: octavia_interface
|
|
|
|
- name: Restart octavia-interface.service if required
|
|
become: True
|
|
systemd:
|
|
name: octavia-interface
|
|
daemon_reload: yes
|
|
state: restarted
|
|
when: octavia_interface.changed
|
|
|
|
- name: Enable and start octavia-interface.service
|
|
become: True
|
|
service:
|
|
name: octavia-interface
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: Wait for interface {{ octavia_network_interface }} ip appear
|
|
vars:
|
|
port_ip: "{{ port_info.port.fixed_ips[0].ip_address }}"
|
|
command: ip address show dev {{ octavia_network_interface }}
|
|
changed_when: false
|
|
register: ip_info
|
|
until: ip_info.stdout.find(port_ip) != -1
|
|
retries: 5
|
|
delay: 2
|
|
|
|
# NOTE(wuchunyang): we have gathered facts at first, but here we add a new
|
|
# network device(o-hm0) which is not collected, so we need gather facts again
|
|
- name: Gather facts
|
|
setup:
|
|
when: octavia_interface.changed
|