openstack-ansible/rpc_deployment/roles/container_common/tasks/add_interfaces.yml

42 lines
1.4 KiB
YAML

---
- name: Drop additional lxc network interfaces
template:
src: "host_container_interface.j2"
dest: "/var/lib/lxc/{{ container_name }}/add_network_interface.conf"
register: host_container_interface
when: provider_networks is defined and is_metal != true
delegate_to: "{{ physical_host }}"
- name: Update container config
lineinfile:
dest: /var/lib/lxc/{{ container_name }}/config
line: "lxc.include = /var/lib/lxc/{{ container_name }}/add_network_interface.conf"
state: present
register: container_net_include
when: host_container_interface|changed and is_metal != true
delegate_to: "{{ physical_host }}"
- name: Drop additional container network interfaces file(s)
template:
src: "container_interface_file.j2"
dest: "/etc/network/interfaces.d/provider_networks.cfg"
register: container_interface
when: provider_networks is defined and is_metal != true
- name: Restart container
lxc: >
command=restart
name="{{ container_name }}"
register: restarted_container
when: container_net_include|changed or host_container_interface|changed or container_interface|changed and is_metal != true
delegate_to: "{{ physical_host }}"
- name: Wait for container networking
wait_for: >
port=22
timeout={{ container_start_timeout }}
search_regex=OpenSSH
host={{ container_address }}
when: restarted_container|changed and is_metal != true
delegate_to: "{{ physical_host }}"