ifupdown2: add minimal role
This commit is contained in:
parent
a29a205576
commit
3d2ce8f79f
1 changed files with 31 additions and 0 deletions
31
roles/ifupdown2/tasks/main.yml
Normal file
31
roles/ifupdown2/tasks/main.yml
Normal 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
|
||||||
|
...
|
Loading…
Reference in a new issue