From a9c492abf63aba9493187a381c5989fd32dfef11 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sat, 15 Apr 2023 23:27:27 +0200 Subject: [PATCH] added sample file and example for netplan conf variable --- README.md | 2 +- defaults/main.yml | 66 ----------------------------- defaults/manage_netplan.yml.sample | 8 ++++ files/netplan_conf_example.yml | 68 ++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 67 deletions(-) create mode 100644 defaults/manage_netplan.yml.sample create mode 100644 files/netplan_conf_example.yml diff --git a/README.md b/README.md index 12a414c..d875101 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ This variable defines whether or not to apply the netplan configuration once it ```yaml manage_netplan_configuration: {} # by default, set to {} ``` -This variable contains the content of your netplan file in yml format. This what will be used to generate the configuration file on the target host. +This variable contains the content of your netplan file in yml format. This what will be used to generate the configuration file on the target host. An example file for this variable is available in `files/netplan_conf_example.yml`. Dependencies diff --git a/defaults/main.yml b/defaults/main.yml index d6514f8..e6dc9d4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,69 +7,3 @@ manage_netplan_search_domain: example.org manage_netplan_install: true manage_netplan_apply: false manage_netplan_configuration: {} -# network: -# version: 2 -# ethernets: -# enp0s3: -# dhcp4: true -# enp0s8: -# addresses: -# - 192.168.250.10/24 -# - 192.168.250.11/24 -# nameservers: -# addresses: -# - 10.0.2.3 -# - 8.8.8.8 -# - 8.8.4.4 -# search: -# # Custom variable -# - "{{ manage_netplan_search_domain }}" -# gateway4: 192.168.250.1 -# optional: true -# routes: -# - to: 0.0.0.0/0 -# via: 9.9.9.9 -# on-link: true -# - to: 192.168.5.0/24 -# via: 192.168.5.1 -# table: 102 -# routing-policy: -# - from: 192.168.5.0/24 -# table: 102 -# lo: -# match: -# name: lo -# addresses: [7.7.7.7/32] -# wifis: -# wlp2s0b1: -# dhcp4: no -# dhcp6: no -# addresses: [192.168.0.21/24] -# gateway4: 192.168.0.1 -# access-points: -# "network_ssid_name": -# password: "**********" -# bonds: -# bond0: -# dhcp4: yes -# interfaces: -# - enp0s3 -# - enp4s0 -# parameters: -# # modes can be one of balance-rr, active-backup, balance-xor, broadcast, -# # 802.3ad, balance-tlb, and balance-alb. -# mode: active-backup -# primary: enp0s3 -# bridges: -# br0: -# dhcp4: yes -# interfaces: -# - enp0s3 -# br0: -# addresses: [10.3.99.25/24] -# interfaces: [vlan15] -# vlans: -# vlan15: -# accept-ra: no -# id: 15 -# link: enp0s25 diff --git a/defaults/manage_netplan.yml.sample b/defaults/manage_netplan.yml.sample new file mode 100644 index 0000000..6d0886b --- /dev/null +++ b/defaults/manage_netplan.yml.sample @@ -0,0 +1,8 @@ +--- +# manage_netplan_config_file: /etc/netplan/ansible-config.yaml +# manage_netplan_renderer: networkd +# manage_netplan_remove_existing: false +# manage_netplan_search_domain: example.org +# manage_netplan_install: true +# manage_netplan_apply: false +# manage_netplan_configuration: {} diff --git a/files/netplan_conf_example.yml b/files/netplan_conf_example.yml new file mode 100644 index 0000000..e7105bf --- /dev/null +++ b/files/netplan_conf_example.yml @@ -0,0 +1,68 @@ +--- +manage_netplan_configuration: + network: + version: 2 + ethernets: + enp0s3: + dhcp4: true + enp0s8: + addresses: + - 192.168.250.10/24 + - 192.168.250.11/24 + nameservers: + addresses: + - 10.0.2.3 + - 8.8.8.8 + - 8.8.4.4 + search: + # Custom variable + - "{{ manage_netplan_search_domain }}" + gateway4: 192.168.250.1 + optional: true + routes: + - to: 0.0.0.0/0 + via: 9.9.9.9 + on-link: true + - to: 192.168.5.0/24 + via: 192.168.5.1 + table: 102 + routing-policy: + - from: 192.168.5.0/24 + table: 102 + lo: + match: + name: lo + addresses: [7.7.7.7/32] + wifis: + wlp2s0b1: + dhcp4: no + dhcp6: no + addresses: [192.168.0.21/24] + gateway4: 192.168.0.1 + access-points: + "network_ssid_name": + password: "**********" + bonds: + bond0: + dhcp4: yes + interfaces: + - enp0s3 + - enp4s0 + parameters: + # modes can be one of balance-rr, active-backup, balance-xor, broadcast, + # 802.3ad, balance-tlb, and balance-alb. + mode: active-backup + primary: enp0s3 + bridges: + br0: + dhcp4: yes + interfaces: + - enp0s3 + br1: + addresses: [10.3.99.25/24] + interfaces: [vlan15] + vlans: + vlan15: + accept-ra: no + id: 15 + link: enp0s25 \ No newline at end of file