Refactor network role

This commit is contained in:
2022-08-31 12:39:41 -05:00
parent 71d1da1cf1
commit e7602bd910
6 changed files with 78 additions and 82 deletions

View File

@ -1,6 +1,3 @@
---
- name: Include netplan vars
include_vars: netplan.yaml
- name: Include netplan tasks
include_tasks: netplan.yml
ansible.builtin.include_tasks: netplan.yml

View File

@ -1,9 +1,18 @@
---
- name: Remove default netplan configuration
ansible.builtin.file:
path: "{{ network_netplan_default_config_path }}"
state: "{{ network_netplan_default_config_state | default('absent') }}"
owner: root
group: root
mode: 0644
notify: netplan apply
- name: Configure netplan
copy:
dest: /etc/netplan/01-netcfg.yaml
ansible.builtin.template:
dest: "{{ network_netplan_config_path }}"
src: netplan.yaml.j2
owner: root
group: root
mode: '0644'
content: "{{ network_netplan_config | to_nice_yaml }}"
notify: netplan apply