ff
This commit is contained in:
@@ -52,7 +52,6 @@
|
|||||||
- dnsmasq
|
- dnsmasq
|
||||||
- iptables
|
- iptables
|
||||||
|
|
||||||
|
|
||||||
- name: Get physical interfaces names WIFI modems
|
- name: Get physical interfaces names WIFI modems
|
||||||
command: find /sys/class/net -type l -lname '*wlp*' -printf '%f\n'
|
command: find /sys/class/net -type l -lname '*wlp*' -printf '%f\n'
|
||||||
register: wifi_int
|
register: wifi_int
|
||||||
@@ -88,12 +87,6 @@
|
|||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# - name: Configure NetworkManager
|
|
||||||
# template:
|
|
||||||
# src: NetworkManager.conf.j2
|
|
||||||
# dest: /etc/NetworkManager/NetworkManager.conf
|
|
||||||
# notify: Reload NetworkManager
|
|
||||||
|
|
||||||
- name: Run nmcli to check if wifi access point connection has already been added
|
- name: Run nmcli to check if wifi access point connection has already been added
|
||||||
shell: /usr/bin/nmcli c | grep {{ wifi_ssid }}
|
shell: /usr/bin/nmcli c | grep {{ wifi_ssid }}
|
||||||
register: nmcli_result
|
register: nmcli_result
|
||||||
@@ -130,23 +123,14 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
nmcli_bridge_failed: "{{ nmcli_result_bridge.rc != 0 }}"
|
nmcli_bridge_failed: "{{ nmcli_result_bridge.rc != 0 }}"
|
||||||
|
|
||||||
|
|
||||||
- name: Run nmcli to add a connection LTE
|
- name: Run nmcli to add a connection LTE
|
||||||
command: /usr/bin/nmcli c add ipv6.method disabled autoconnect yes save yes con-name {{ LTE_con_name }} ifname cdc-wdm0 type gsm apn "internet"
|
command: /usr/bin/nmcli c add ipv6.method disabled autoconnect yes save yes con-name {{ LTE_con_name }} ifname cdc-wdm0 type gsm apn "internet"
|
||||||
tags: br
|
|
||||||
when: nmcli_lte_failed
|
when: nmcli_lte_failed
|
||||||
|
|
||||||
- name: Configure bridge
|
- name: Configure 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
|
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 {{ wifi_int_ip }}/24
|
||||||
tags: br
|
|
||||||
when: nmcli_bridge_failed
|
when: nmcli_bridge_failed
|
||||||
# - name: Configure bridge1
|
|
||||||
# command: /usr/bin/nmcli c add type ethernet slave-type bridge con-name 'Ethernet' ifname {{ int_name }} master br0
|
|
||||||
# loop:
|
|
||||||
# - enp90s0
|
|
||||||
# loop_control:
|
|
||||||
# loop_var: int_name
|
|
||||||
# tags: br
|
|
||||||
- name: Configure bridge1
|
- name: Configure bridge1
|
||||||
command: /usr/bin/nmcli c add ipv6.method disabled type bridge-slave con-name 'Ethernet' ifname {{ int_name }} master br0 autoconnect yes save yes
|
command: /usr/bin/nmcli c add ipv6.method disabled type bridge-slave con-name 'Ethernet' ifname {{ int_name }} master br0 autoconnect yes save yes
|
||||||
loop:
|
loop:
|
||||||
@@ -155,10 +139,6 @@
|
|||||||
loop_var: int_name
|
loop_var: int_name
|
||||||
when: nmcli_eth_failed
|
when: nmcli_eth_failed
|
||||||
|
|
||||||
# - 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
|
- 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 ipv4.method shared autoconnect yes save yes con-name {{ wifi_ssid }} ifname {{ wifi_int.stdout }} \
|
command: /usr/bin/nmcli c add ipv4.method shared autoconnect yes save yes con-name {{ wifi_ssid }} ifname {{ wifi_int.stdout }} \
|
||||||
type wifi \
|
type wifi \
|
||||||
@@ -174,36 +154,6 @@
|
|||||||
wifi-sec.key-mgmt wpa-psk
|
wifi-sec.key-mgmt wpa-psk
|
||||||
when: nmcli_failed
|
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 a \
|
|
||||||
# wifi.mode ap \
|
|
||||||
# wifi-sec.proto rsn \
|
|
||||||
# wifi-sec.pairwise ccmp \
|
|
||||||
# wifi-sec.psk {{ wifi_psk }} \
|
|
||||||
# wifi-sec.key-mgmt wpa-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-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 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 Ethernet
|
|
||||||
|
|
||||||
- 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:
|
||||||
@@ -213,39 +163,3 @@
|
|||||||
tags:
|
tags:
|
||||||
- iptables
|
- iptables
|
||||||
- flush
|
- flush
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# - name: Configure {{ wifi_int.stdout_lines | first }} interface
|
|
||||||
# template:
|
|
||||||
# src: 25-wireless.network.j2
|
|
||||||
# dest: /etc/systemd/network/25-wireless.network
|
|
||||||
# notify: Restart systemd-networkd
|
|
||||||
|
|
||||||
# - name: Configure NetworkManager
|
|
||||||
# template:
|
|
||||||
# src: unmanaged.conf.j2
|
|
||||||
# dest: /etc/NetworkManager/conf.d/unmanaged.conf
|
|
||||||
# notify: Restart NetworkManager
|
|
||||||
|
|
||||||
# - name: Configure hostapd
|
|
||||||
# template:
|
|
||||||
# src: hostapd.conf.j2
|
|
||||||
# dest: /etc/hostapd/hostapd.conf
|
|
||||||
# notify: Restart hostapd
|
|
||||||
|
|
||||||
# - name: Configure hostapd
|
|
||||||
# template:
|
|
||||||
# src: dhcpd.conf.j2
|
|
||||||
# dest: /etc/dhcpd.conf
|
|
||||||
# # notify: Restart dhcpd
|
|
||||||
|
|
||||||
# - name: Enable services
|
|
||||||
# service: "{{ app }}"
|
|
||||||
# enabled: yes
|
|
||||||
# loop: "{{ apps }}"
|
|
||||||
# loop_control:
|
|
||||||
# loop_var: "app"
|
|
||||||
# - name: Force all notified handlers to run at this point
|
|
||||||
# ansible.builtin.meta: flush_handlers
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
[Match]
|
|
||||||
Name={{ wifi_int.stdout_lines | first }}
|
|
||||||
|
|
||||||
[Network]
|
|
||||||
Address={{ wifi_int_ip }}/24
|
|
||||||
#Gateway=
|
|
||||||
#DNS=
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# MANAGED BY ANSIBLE DONT TOUCH BY HANDS #
|
|
||||||
[main]
|
|
||||||
dns=dnsmasq
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
option domain-name-servers {{ dns1 }}, {{ dns2 }};
|
|
||||||
option subnet-mask {{ netmask }};
|
|
||||||
option routers {{ wifi_int_ip }};
|
|
||||||
subnet {{ subnet }} netmask {{ netmask }} {
|
|
||||||
range {{ range_start }} {{ range_end }};
|
|
||||||
}
|
|
||||||
default-lease-time {{ default_lease_time }};
|
|
||||||
max-lease-time {{ max_lease_time }};
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# 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
|
interface=br0
|
||||||
{% for nameserver in nameservers %}
|
{% for nameserver in nameservers %}
|
||||||
server={{ nameserver }}
|
server={{ nameserver }}
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
# Set up some logging. VERY useful to see why things aren't working.
|
|
||||||
logger_syslog=-1
|
|
||||||
logger_syslog_level=2
|
|
||||||
logger_stdout=-1
|
|
||||||
logger_stdout_level=2
|
|
||||||
|
|
||||||
# Which interface to use and which bridge to join
|
|
||||||
interface={{ wifi_int.stdout_lines | first }}
|
|
||||||
#bridge=br0
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
wmm_enabled=1
|
|
||||||
wme_enabled=1
|
|
||||||
ieee80211n=1
|
|
||||||
#ieee80211d=1
|
|
||||||
#noscan=1
|
|
||||||
#
|
|
||||||
# Use this driver for AP stuff. This corresponds to the mac80211 driver
|
|
||||||
# which most newer cards support.
|
|
||||||
driver=nl80211
|
|
||||||
|
|
||||||
# 802.11 mode and channel, pretty self-explanatory
|
|
||||||
hw_mode=g
|
|
||||||
country_code=RU
|
|
||||||
channel=9
|
|
||||||
|
|
||||||
|
|
||||||
# Set and broadcast the SSID. Stupid double-negatives...
|
|
||||||
ssid={{ wifi_ssid }}
|
|
||||||
ignore_broadcast_ssid=0
|
|
||||||
|
|
||||||
# 802.11N stuff - Try 40 MHz channels, fall back to 20 MHz
|
|
||||||
#ieee80211n=1
|
|
||||||
#ht_capab=[HT40+][SHORT-GI-40]
|
|
||||||
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40]
|
|
||||||
#ht_capab=[HT40-][HT40+][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40]
|
|
||||||
# WPA Authentication
|
|
||||||
auth_algs=1
|
|
||||||
wpa=2
|
|
||||||
wpa_passphrase={{ wifi_psk }}
|
|
||||||
wpa_key_mgmt=WPA-PSK
|
|
||||||
rsn_pairwise=CCMP
|
|
||||||
|
|
||||||
macaddr_acl=0
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[keyfile]
|
|
||||||
unmanaged-devices=interface-name:{{ wifi_int.stdout_lines | first }}
|
|
||||||
Reference in New Issue
Block a user