ff
This commit is contained in:
@@ -16,11 +16,12 @@
|
|||||||
wifi_psk: "test12345"
|
wifi_psk: "test12345"
|
||||||
wifi_int_ip: 10.1.10.1
|
wifi_int_ip: 10.1.10.1
|
||||||
# dhcpd
|
# dhcpd
|
||||||
|
lease_time: 10800
|
||||||
subnet: 10.1.10.0
|
subnet: 10.1.10.0
|
||||||
netmask: 255.255.255.0
|
netmask: 255.255.255.0
|
||||||
range_start: 10.1.10.10
|
range_start: 10.1.10.10
|
||||||
range_end: 10.1.10.200
|
range_end: 10.1.10.200
|
||||||
default_lease_time: 600
|
default_lease_time: 600
|
||||||
max_lease_time: 7200
|
max_lease_time: 10800
|
||||||
dns1: 77.88.8.8
|
dns1: 77.88.8.8
|
||||||
dns2: 77.88.8.1
|
dns2: 77.88.8.1
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
when: disable_ipv6_reload_sysctl_if_changed
|
when: disable_ipv6_reload_sysctl_if_changed
|
||||||
|
|
||||||
- name: Restart NetworkManager
|
- name: Reload NetworkManager
|
||||||
service:
|
service:
|
||||||
name: NetworkManager
|
name: NetworkManager
|
||||||
state: restarted
|
state: reloaded
|
||||||
|
|
||||||
- name: Restart hostapd
|
- name: Restart hostapd
|
||||||
service:
|
service:
|
||||||
|
|||||||
@@ -35,12 +35,29 @@
|
|||||||
state: stopped
|
state: stopped
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
- name: Get physical interfaces names
|
- name: Configure dnsmasq
|
||||||
|
template:
|
||||||
|
src: dnsmasq.conf.j2
|
||||||
|
dest: /etc/dnsmasq.conf
|
||||||
|
|
||||||
|
- name: Configure NetworkManager
|
||||||
|
template:
|
||||||
|
src: NetworkManager.conf.j2
|
||||||
|
dest: /etc/NetworkManager/NetworkManager.conf
|
||||||
|
notify: Reload NetworkManager
|
||||||
|
|
||||||
|
- 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
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: false
|
check_mode: false
|
||||||
|
|
||||||
|
- name: Get physical interfaces names LTE modems
|
||||||
|
command: find /sys/class/net -type l -lname '*wwp*' -printf '%f\n'
|
||||||
|
register: lte_int
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
- 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
|
||||||
@@ -54,6 +71,9 @@
|
|||||||
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 }}
|
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
|
when: nmcli_failed
|
||||||
|
|
||||||
|
- name: Run nmcli to add a connection LTE
|
||||||
|
command: /usr/bin/nmcli c add autoconnect yes save yes con-name TLE ifname {{ lte_int.stdout }} type gsm apn "internet"
|
||||||
|
|
||||||
- name: Run nmcli to add WPA-PSK security to the wifi connection
|
- name: Run nmcli to add WPA-PSK security to the wifi connection
|
||||||
command: /usr/bin/nmcli c mod {{ wifi_ssid }} \
|
command: /usr/bin/nmcli c mod {{ wifi_ssid }} \
|
||||||
802-11-wireless.band bg \
|
802-11-wireless.band bg \
|
||||||
|
|||||||
2
roles/configure/templates/NetworkManager.conf.j2
Normal file
2
roles/configure/templates/NetworkManager.conf.j2
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[main]
|
||||||
|
dns=dnsmasq
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
interface={{ wifi_int.stdout_lines | first }}
|
|
||||||
dhcp-range={{ range_start }},{{ range_end }},2h
|
|
||||||
log-queries
|
|
||||||
#log-dhcp
|
|
||||||
log-facility=/var/log/dnsmasq.log
|
|
||||||
10
roles/configure/templates/dnsmasq.conf.j2
Normal file
10
roles/configure/templates/dnsmasq.conf.j2
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
interface={{ wifi_int.stdout_lines | first }}
|
||||||
|
dhcp-range={{ range_start }},{{ range_end }},2h
|
||||||
|
dhcp-option=1,{{ netmask }}
|
||||||
|
dhcp-option=2,{{ lease_time }} # время аренды в секундах
|
||||||
|
dhcp-option=3,{{ wifi_int_ip }} # шлюз по умолчанию
|
||||||
|
dhcp-option=6,{{ dns1 }}
|
||||||
|
dhcp-authoritative
|
||||||
|
log-queries
|
||||||
|
#log-dhcp
|
||||||
|
log-facility=/var/log/dnsmasq.log
|
||||||
Reference in New Issue
Block a user