This commit is contained in:
jonas
2021-10-18 08:26:26 +02:00
parent de1f37983b
commit 7f0b81f7ac
3 changed files with 4 additions and 4 deletions

View File

@@ -8,12 +8,12 @@ create device {{ ifname }}:
set ip address on {{ ifname }}:
cmd.run:
- name: nmcli connection modify {{ ifname }} ipv4.addresses {{ vlan['address'] }}/24
- unless: bash -c "if [[ \"$(nmcli connection show Wired\ connection\ 1 | sed -n 's/^ipv4.addresses.\s*\(.*\)$/\1/p')\" == "{{ vlan['address'] }}/24" ]]; then exit 0; else exit 1;fi"
- unless: bash -c "if [[ \"$(nmcli connection show {{ ifname }} | sed -n 's/^ipv4.addresses.\s*\(.*\)$/\1/p')\" == "{{ vlan['address'] }}/24" ]]; then exit 0; else exit 1;fi"
set ip static on {{ ifname }}:
cmd.run:
- name: nmcli connection modify {{ ifname }} ipv4.method manual
- unless: bash -c "if [[ \"$(nmcli connection show Wired\ connection\ 1 | sed -n 's/^ipv4.method.\s*\(.*\)$/\1/p')\" == "manual" ]]; then exit 0; else exit 1;fi"
- unless: bash -c "if [[ \"$(nmcli connection show {{ ifname }} | sed -n 's/^ipv4.method.\s*\(.*\)$/\1/p')\" == "manual" ]]; then exit 0; else exit 1;fi"
bring up {{ ifname }}:
cmd.run: