2022-08-26 10:13:37 +02:00
|
|
|
---
|
|
|
|
- name: Gather package facts
|
|
|
|
package_facts:
|
|
|
|
manager: apt
|
|
|
|
|
|
|
|
- name: Check if ifupdown2 is installed
|
|
|
|
set_fact:
|
|
|
|
must_mask: "{{ 'ifupdown2' not in ansible_facts.packages }}"
|
|
|
|
|
|
|
|
- name: Mask networking before installing ifupdown2
|
|
|
|
systemd:
|
|
|
|
name: networking.service
|
|
|
|
masked: true
|
|
|
|
when: must_mask
|
|
|
|
|
2022-08-27 21:04:36 +02:00
|
|
|
- name: Install ifupdown2 (debian version)
|
2022-08-26 10:13:37 +02:00
|
|
|
apt:
|
|
|
|
name: ifupdown2
|
2022-08-27 21:04:36 +02:00
|
|
|
when: "not ifupdown2__need_upstream_version"
|
|
|
|
|
|
|
|
# FIXME: ifupdown2 3.1.0-1 is not yet available, but is needed for its
|
|
|
|
# better VxLAN support
|
|
|
|
# See https://github.com/CumulusNetworks/ifupdown2/issues/211
|
|
|
|
- name: Install upstream version of ifupdown2
|
|
|
|
block:
|
|
|
|
- name: Upload .deb file
|
|
|
|
copy:
|
|
|
|
src: ifupdown2_3.1.0-1_all.deb
|
|
|
|
dest: /tmp/ifupdown2_3.1.0-1_all.deb
|
|
|
|
- name: Install .deb file
|
|
|
|
apt:
|
|
|
|
deb: /tmp/ifupdown2_3.1.0-1_all.deb
|
|
|
|
when: "ifupdown2__need_upstream_version"
|
2022-08-26 10:13:37 +02:00
|
|
|
|
|
|
|
- name: Unmask networking now that ifupdown2 is installed
|
|
|
|
systemd:
|
|
|
|
name: networking.service
|
|
|
|
masked: false
|
|
|
|
when: must_mask
|
|
|
|
|
2022-08-26 20:52:23 +02:00
|
|
|
- name: Configure ifupdown2
|
|
|
|
template:
|
|
|
|
src: interfaces.j2
|
|
|
|
dest: /etc/network/interfaces
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=
|
|
|
|
notify:
|
|
|
|
- Restart networking
|
2022-08-27 04:46:16 +02:00
|
|
|
- Bring all interfaces up
|
2022-08-26 20:52:23 +02:00
|
|
|
|
2022-08-26 10:13:37 +02:00
|
|
|
- name: Enable and start networking
|
|
|
|
systemd:
|
|
|
|
name: networking.service
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
...
|