Skip to content

Commit

Permalink
netplan
Browse files Browse the repository at this point in the history
  • Loading branch information
jvonau committed Apr 30, 2020
1 parent eeab4b0 commit e16cc65
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions roles/network/tasks/netplan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
with_items:
- "{{ netplan.stdout_lines }}"

- name: Remove stock netplan template
file:
state: absent
path: /etc/netplan/{{ item }}
when: netplan.stdout.find("yaml") != -1 and item|trim != "02-iiab-config.yaml"
- name: Moving 50-cloud-init.yaml to 02-iiab-config.yaml
shell: mv /etc/netplan/50-cloud-init.yaml /etc/netplan/02-iiab-config.yaml
when: netplan.stdout.find("yaml") != -1 and item|trim == "50-cloud-init.yaml"
with_items:
- "{{ netplan.stdout_lines }}"

Expand All @@ -25,6 +23,11 @@
- systemd-networkd-wait-online
when: systemd_networkd_active | bool

- name: Ensure systemd-networkd gets enabled for br0
set_fact:
systemd_networkd_active: True
when: network_manager_active | bool and iiab_lan_iface == "br0"

# 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
# overrides gui_static_wan_ip that is present. Changing wan_ip in local_vars
Expand All @@ -39,12 +42,20 @@
wan_cidr: "{{ CIDR.stdout }}"
when: wan_ip != "dhcp"

- name: Supply netplan template
template:
dest: /etc/netplan/01-iiab-config.yaml
src: network/netplan.j2
backup: no
when: iiab_wan_iface != discovered_wireless_iface
- name: Remove stock netplan template
file:
state: absent
path: /etc/netplan/{{ item }}
when: netplan.stdout.find("yaml") != -1 and item|trim != "02-iiab-config.yaml" and wan_ip != "dhcp"
with_items:
- "{{ netplan.stdout_lines }}"

#- name: Supply netplan template
# template:
# dest: /etc/netplan/01-iiab-config.yaml
# src: network/netplan.j2
# backup: no
# when: iiab_wan_iface != discovered_wireless_iface and wan_ip != "dhcp"

# should blow up here if we messed up the yml file
#- name: Generate netplan config
Expand Down

0 comments on commit e16cc65

Please sign in to comment.