ifupdown2: add minimal role

This commit is contained in:
jeltz 2022-08-26 10:13:37 +02:00
parent a29a205576
commit 3d2ce8f79f
Signed by: jeltz
GPG key ID: 800882B66C0C3326

View file

@ -0,0 +1,31 @@
---
- 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
- name: Install ifupdown2
apt:
name: ifupdown2
- name: Unmask networking now that ifupdown2 is installed
systemd:
name: networking.service
masked: false
when: must_mask
- name: Enable and start networking
systemd:
name: networking.service
state: started
enabled: true
...