Set up netplan in Debian-like systems.
netplan.io
(will be installed)nplan
(will be installed)
-
netplan_install
[default:[]
]: Additional packages to install -
netplan_version
[default:2
]: Version -
netplan_renderer
[default:networkd
]: Renderer -
netplan_conf_file
[default:config.yaml
]: Config file name (relative tonetplan_conf_path
) -
netplan_conf
[default:''
]: Config in yaml format as a string (to be parsed, formatted and written down tonetplan_conf_file
) -
netplan_conf_purge
[default:false
]: Whether or not to purge all "other" config files
None
---
- hosts: all
roles:
- oefenweb.netplan
---
- hosts: all
roles:
- oefenweb.netplan
vars:
netplan_conf_file: 01-netcfg.yaml
netplan_conf: |
network:
version: {{ netplan_version }}
renderer: {{ netplan_renderer }}
ethernets:
{{ hostvars[inventory_hostname]['ansible_' + (ansible_interfaces | difference(['lo']) | sort | list | first)]['device'] }}:
dhcp4: true
{{ hostvars[inventory_hostname]['ansible_' + (ansible_interfaces | difference(['lo']) | sort | list | last)]['device'] }}:
addresses:
- {{ hostvars[inventory_hostname]['ansible_' + (ansible_interfaces | difference(['lo']) | sort | list | last)]['ipv4']['address'] }}/24
netplan_conf_purge: true
MIT
Mischa ter Smitten (based on work of Lucas Harms)
Are welcome!