From c2466faac6f8f9df093d125db622946d3b259739 Mon Sep 17 00:00:00 2001 From: Aleksandr Malyavin Date: Wed, 4 Sep 2024 20:51:30 +0300 Subject: [PATCH] ff --- roles/configure/tasks/main.yaml | 81 +++++++++++++---------- roles/configure/templates/dnsmasq.conf.j2 | 7 +- 2 files changed, 49 insertions(+), 39 deletions(-) diff --git a/roles/configure/tasks/main.yaml b/roles/configure/tasks/main.yaml index c8c521f..ecb21e8 100644 --- a/roles/configure/tasks/main.yaml +++ b/roles/configure/tasks/main.yaml @@ -80,58 +80,67 @@ set_fact: 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" - tags: br + +# - 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" +# tags: br + - 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 + - name: Configure bridge1 - command: /usr/bin/nmcli c add type bridge-slave ifname {{ int_name }} master br0 - loop: - - wlp88s0 + command: /usr/bin/nmcli c add type ethernet slave-type bridge con-name 'Ethernet' ifname {{ int_name }} master br0 + loop: - enp90s0 - loop_control: + loop_control: loop_var: int_name tags: br -- name: set ip for bridge - command: /usr/bin/nmcli c mod bridge ipv4.addr {{ wifi_int_ip }}/24 ipv4.method manual - tags: br +# - name: set ip for bridge +# command: /usr/bin/nmcli c mod bridge ipv4.addr {{ wifi_int_ip }}/24 ipv4.method manual +# 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 command: /usr/bin/nmcli c up bridge 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 command: /usr/bin/nmcli c up {{ wifi_ssid }} -- name: Run nmcli to activate LTE access point connection - command: /usr/bin/nmcli c up {{ LTE_con_name }} +# - name: Run nmcli to activate LTE access point connection +# command: /usr/bin/nmcli c up {{ LTE_con_name }} -- name: Apply tags to tasks within included file - include_tasks: iptables.yaml - args: - apply: - tags: - - iptables - tags: - - iptables - - flush +# - name: Apply tags to tasks within included file +# include_tasks: iptables.yaml +# args: +# apply: +# tags: +# - iptables +# tags: +# - iptables +# - flush diff --git a/roles/configure/templates/dnsmasq.conf.j2 b/roles/configure/templates/dnsmasq.conf.j2 index 6ab2253..b2319fa 100644 --- a/roles/configure/templates/dnsmasq.conf.j2 +++ b/roles/configure/templates/dnsmasq.conf.j2 @@ -1,7 +1,8 @@ # MANAGED BY ANSIBLE DONT TOUCH BY HANDS # -{% for interface in without_lte.stdout_lines %} -interface={{ interface }} -{% endfor %} +# {% for interface in without_lte.stdout_lines %} +# interface={{ interface }} +# {% endfor %} +interface=br0 {% for nameserver in nameservers %} server={{ nameserver }} {% endfor %}