Configure /etc/network/interfaces and /etc/resolv.conf using Ansible #98

Merged
jeltz merged 7 commits from ifupdown2 into master 2022-08-27 04:55:31 +02:00
Showing only changes of commit 3d2ce8f79f - Show all commits

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
...