mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
refine netplan
This commit is contained in:
parent
343d00848f
commit
d0c66fb4d3
1 changed files with 24 additions and 20 deletions
|
@ -1,21 +1,11 @@
|
||||||
# netplan.yml
|
# netplan.yml
|
||||||
- name: Figure out netplan file name on Ubuntu 18
|
- name: Figure out netplan file name on Ubuntu 18
|
||||||
shell: ls /etc/netplan
|
shell: ls /etc/netplan | grep -v -e 01-iiab-config
|
||||||
register: netplan
|
register: netplan
|
||||||
|
|
||||||
- name: Remove stock netplan template
|
# Think 50-cloud-init.yaml is created on the fly by cloud-init on every boot
|
||||||
file:
|
# need to double check the timestamps of the file on a rebooted machine
|
||||||
state: absent
|
# disable cloud-init if that holds true
|
||||||
dest: /etc/netplan/{{ netplan }}
|
|
||||||
|
|
||||||
# Was needed at one point retesting current needs
|
|
||||||
#- name: Disable and mask systemd-networkd-wait-online
|
|
||||||
# systemd:
|
|
||||||
# name: systemd-networkd-wait-online
|
|
||||||
# enabled: no
|
|
||||||
# masked: yes
|
|
||||||
# state: stopped
|
|
||||||
|
|
||||||
- name: Disable and mask cloud-init
|
- name: Disable and mask cloud-init
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
|
@ -27,11 +17,24 @@
|
||||||
- cloud-init
|
- cloud-init
|
||||||
when: "{{ netplan }}" == "50-cloud-init.yaml"
|
when: "{{ netplan }}" == "50-cloud-init.yaml"
|
||||||
|
|
||||||
|
- name: Remove stock netplan template
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
dest: /etc/netplan/{{ netplan }}
|
||||||
|
when: netplan != ""
|
||||||
|
|
||||||
|
# Was needed at one point retesting current needs
|
||||||
|
#- name: Disable and mask systemd-networkd-wait-online
|
||||||
|
# systemd:
|
||||||
|
# name: systemd-networkd-wait-online
|
||||||
|
# enabled: no
|
||||||
|
# masked: yes
|
||||||
|
# state: stopped
|
||||||
|
|
||||||
# ICO will always set gui_static_wan_ip away from the default of 'unset' while
|
# ICO will always set gui_static_wan_ip away from the default of 'unset' while
|
||||||
# gui_static_wan turns dhcp on/off through wan_ip in computed_network and
|
# gui_static_wan turns dhcp on/off through wan_ip in computed_network and
|
||||||
# overrides gui_static_wan_ip that is present. Changing wan_ip in local_vars
|
# overrides gui_static_wan_ip that is present. Changing wan_ip in local_vars
|
||||||
# is a oneway street to static.
|
# is a oneway street to static.
|
||||||
|
|
||||||
- name: Static IP computing CIDR
|
- name: Static IP computing CIDR
|
||||||
shell: netmask {{ wan_ip }}/{{ wan_netmask }} | awk -F "/" '{print $2}'
|
shell: netmask {{ wan_ip }}/{{ wan_netmask }} | awk -F "/" '{print $2}'
|
||||||
register: CIDR
|
register: CIDR
|
||||||
|
@ -48,19 +51,20 @@
|
||||||
src: network/netplan.j2
|
src: network/netplan.j2
|
||||||
backup: no
|
backup: no
|
||||||
|
|
||||||
- name: Stopping services
|
|
||||||
include_tasks: down-debian.yml
|
|
||||||
|
|
||||||
- name: generate netplan config
|
- name: generate netplan config
|
||||||
shell: netplan generate --debug
|
shell: netplan generate --debug
|
||||||
|
|
||||||
# wants a controlling terminal so it fails
|
- name: Stopping services
|
||||||
|
include_tasks: down-debian.yml
|
||||||
|
|
||||||
|
# wants a controlling terminal for the ENTER key, so it fails
|
||||||
- name: test netplan config
|
- name: test netplan config
|
||||||
shell: netplan try --debug --timeout=2
|
shell: netplan try --debug --timeout=2
|
||||||
register: test-netplan
|
register: test-netplan
|
||||||
ignore_errors: True
|
ignore_errors: True
|
||||||
|
|
||||||
# and does not apply this config until rebooted or ignore the above test
|
# and does not apply the generated config until rebooted
|
||||||
|
# or ignore the above test - on the fence atm...
|
||||||
- name: Reload netplan
|
- name: Reload netplan
|
||||||
shell: netplan apply
|
shell: netplan apply
|
||||||
when: not no_net_restart and test-netplan == "Configuration accepted"
|
when: not no_net_restart and test-netplan == "Configuration accepted"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue