This commit is contained in:
2024-09-03 21:42:54 +03:00
parent 37c37cb98b
commit d1cab7f74f
3 changed files with 144 additions and 115 deletions

View File

@@ -76,17 +76,40 @@
register: nmcli_result
ignore_errors: True
- name: Check result nmcli
- name: Check result nmcli {{ wifi_ssid }}
set_fact:
nmcli_failed: "{{ nmcli_result.rc != 0 }}"
# - name: Run nmcli to check if phy1 connection has already been added
# shell: /usr/bin/nmcli c | grep {{ phy_int1_name }}
# register: phy1_result
# ignore_errors: True
# - name: Check result nmcli {{ phy_int1_name }}
# set_fact:
# phy1_failed: "{{ phy1_result.rc != 0 }}"
- name: Run nmcli to check if phy2 connection has already been added
shell: /usr/bin/nmcli c | grep {{ phy_int2_name }}
register: phy2_result
ignore_errors: True
- name: Check result nmcli {{ phy_int2_name }}
set_fact:
phy2_failed: "{{ phy2_result.rc != 0 }}"
- name: Run nmcli to add a connection with the specified parameters as a wifi access point if above check has failed
command: /usr/bin/nmcli c add autoconnect yes save yes con-name {{ wifi_ssid }} ifname {{ wifi_int.stdout }} type wifi ssid {{ wifi_ssid }} mode ap ip4 {{ wifi_int_ip }}
when: nmcli_failed
- name: Configure physical interface
command: /usr/bin/nmcli c add autoconnect yes save yes con-name eth1 ifname enp90s0 type ethernet ipv4.method manual ipv4.address 10.1.10.2
when: nmcli_failed
# - name: Configure physical interface 1
# command: /usr/bin/nmcli c add autoconnect yes save yes con-name {{ phy_int1_name }} ifname {{ phy1_iface_name }} type ethernet ipv4.method shared ipv4.address {{ phy_int1 }}
# when: phy1_failed
- name: Configure physical interface 1
command: /usr/bin/nmcli c add autoconnect yes save yes con-name {{ phy_int2_name }} ifname {{ phy2_iface_name }} type ethernet ipv4.method shared ipv4.address {{ phy_int2 }}
when: phy2_failed
- name: Run nmcli to add a connection LTE
command: /usr/bin/nmcli c add autoconnect yes save yes con-name {{ LTE_con_name }} ifname cdc-wdm0 type gsm apn "internet"