This commit is contained in:
2024-09-04 20:51:30 +03:00
parent 08b25c1d92
commit c2466faac6
2 changed files with 49 additions and 39 deletions

View File

@@ -80,58 +80,67 @@
set_fact: set_fact:
nmcli_failed: "{{ nmcli_result.rc != 0 }}" nmcli_failed: "{{ nmcli_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
when: nmcli_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" # - name: Run nmcli to add a connection LTE
tags: br # command: /usr/bin/nmcli c add autoconnect yes save yes con-name {{ LTE_con_name }} ifname cdc-wdm0 type gsm apn "internet"
# tags: br
- name: Configure bridge - name: Configure bridge
command: /usr/bin/nmcli c add type bridge ifname br0 autoconnect yes save yes con-name bridge command: /usr/bin/nmcli c add type bridge ifname br0 autoconnect yes save yes con-name bridge stp no ipv6.method disabled ipv4.method manual ipv4.addr 10.1.10.1/24
tags: br tags: br
- name: Configure bridge1 - name: Configure bridge1
command: /usr/bin/nmcli c add type bridge-slave ifname {{ int_name }} master br0 command: /usr/bin/nmcli c add type ethernet slave-type bridge con-name 'Ethernet' ifname {{ int_name }} master br0
loop: loop:
- wlp88s0
- enp90s0 - enp90s0
loop_control: loop_control:
loop_var: int_name loop_var: int_name
tags: br tags: br
- name: set ip for bridge # - name: set ip for bridge
command: /usr/bin/nmcli c mod bridge ipv4.addr {{ wifi_int_ip }}/24 ipv4.method manual # command: /usr/bin/nmcli c mod bridge ipv4.addr {{ wifi_int_ip }}/24 ipv4.method manual
tags: br # tags: br
- 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 ipv4.method shared c add autoconnect yes save yes con-name {{ wifi_ssid }} ifname {{ wifi_int.stdout }} type wifi slave-type bridge master br0 wifi.ssid {{ wifi_ssid }} wifi.mode ap wifi-sec.proto rsn wifi-sec.pairwise ccmp wifi-sec.psk {{ wifi_psk }} wifi-sec.key-mgmt wpa-psk
# when: nmcli_failed
# - name: Run nmcli to add WPA-PSK security to the wifi connection
# command: /usr/bin/nmcli c mod {{ wifi_ssid }} \
# 802-11-wireless.band bg \
# 802-11-wireless.channel 1 \
# 802-11-wireless-security.key-mgmt wpa-psk \
# 802-11-wireless-security.proto rsn \
# 802-11-wireless-security.group ccmp \
# 802-11-wireless-security.pairwise ccmp \
# 802-11-wireless-security.psk {{ wifi_psk }} \
# - name: Run nmcli to add WPA-PSK security to the wifi connection
# command: /usr/bin/nmcli c mod {{ wifi_ssid }} \
# 802-11-wireless.band bg \
# 802-11-wireless.channel 1 \
# 802-11-wireless-security.key-mgmt wpa-psk \
# 802-11-wireless-security.proto rsn \
# 802-11-wireless-security.group ccmp \
# 802-11-wireless-security.pairwise ccmp \
# 802-11-wireless-security.psk {{ wifi_psk }} \
- name: set ip for bridge - name: set ip for bridge
command: /usr/bin/nmcli c up bridge command: /usr/bin/nmcli c up bridge
tags: br tags: br
- name: Run nmcli to add WPA-PSK security to the wifi connection
command: /usr/bin/nmcli c mod {{ wifi_ssid }} \
802-11-wireless.band bg \
802-11-wireless.channel 1 \
802-11-wireless-security.key-mgmt wpa-psk \
802-11-wireless-security.proto rsn \
802-11-wireless-security.group ccmp \
802-11-wireless-security.pairwise ccmp \
802-11-wireless-security.psk {{ wifi_psk }} \
ipv4.method shared
- name: Run nmcli to activate wifi access point connection - name: Run nmcli to activate wifi access point connection
command: /usr/bin/nmcli c up {{ wifi_ssid }} command: /usr/bin/nmcli c up {{ wifi_ssid }}
- name: Run nmcli to activate LTE access point connection # - name: Run nmcli to activate LTE access point connection
command: /usr/bin/nmcli c up {{ LTE_con_name }} # command: /usr/bin/nmcli c up {{ LTE_con_name }}
- name: Apply tags to tasks within included file # - name: Apply tags to tasks within included file
include_tasks: iptables.yaml # include_tasks: iptables.yaml
args: # args:
apply: # apply:
tags: # tags:
- iptables # - iptables
tags: # tags:
- iptables # - iptables
- flush # - flush

View File

@@ -1,7 +1,8 @@
# MANAGED BY ANSIBLE DONT TOUCH BY HANDS # # MANAGED BY ANSIBLE DONT TOUCH BY HANDS #
{% for interface in without_lte.stdout_lines %} # {% for interface in without_lte.stdout_lines %}
interface={{ interface }} # interface={{ interface }}
{% endfor %} # {% endfor %}
interface=br0
{% for nameserver in nameservers %} {% for nameserver in nameservers %}
server={{ nameserver }} server={{ nameserver }}
{% endfor %} {% endfor %}