.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
country_code={{ pillar['hostapd']['country_code'] }}
|
||||
interface={{ pillar['network']['interface']['wireless'] }}
|
||||
bridge={{ pillar['network']['interface']['bridge'] }}
|
||||
interface={{ pillar['network']['wireless'] }}
|
||||
bridge={{ pillar['network']['bridge'] }}
|
||||
ssid={{ pillar['hostapd']['ssid'] }}
|
||||
hw_mode=g
|
||||
channel={{ pillar['hostapd']['channel'] }}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
Set {{ pillar['network']['interface']['wireless'] }} to not be managed by NetworkManager:
|
||||
Set {{ pillar['network']['wireless'] }} to not be managed by NetworkManager:
|
||||
cmd.run:
|
||||
- name: nmcli device set {{ pillar['network']['interface']['wireless'] }} managed no
|
||||
- unless: bash -c "if [[ \"$(nmcli device show {{ pillar['network']['interface']['wireless'] }} | sed -n 's/^GENERAL.STATE.*(\(.*\)).*$/\1/p')\" == \"unmanaged\" ]]; then exit 0; else exit 1; fi"
|
||||
- name: nmcli device set {{ pillar['network']['wireless'] }} managed no
|
||||
- unless: bash -c "if [[ \"$(nmcli device show {{ pillar['network']['wireless'] }} | sed -n 's/^GENERAL.STATE.*(\(.*\)).*$/\1/p')\" == \"unmanaged\" ]]; then exit 0; else exit 1; fi"
|
||||
|
||||
Delete {{ pillar['network']['interface']['internal'] }} connection:
|
||||
Delete {{ pillar['network']['interface'] }} connection:
|
||||
cmd.run:
|
||||
- name: nmcli connection delete {{ pillar['network']['interface']['internal'] }}
|
||||
- unless: nmcli connection show {{ pillar['network']['interface']['internal'] }} > /dev/null
|
||||
- name: nmcli connection delete {{ pillar['network']['interface'] }}
|
||||
- unless: nmcli connection show {{ pillar['network']['interface'] }} > /dev/null
|
||||
|
||||
Install hostapd:
|
||||
pkg.installed:
|
||||
@@ -28,19 +28,19 @@ Start hostapd:
|
||||
- watch:
|
||||
- file: Configure hostapd
|
||||
|
||||
Set {{ pillar['network']['interface']['bridge'] }} to be managed by NetworkManager:
|
||||
Set {{ pillar['network']['bridge'] }} to be managed by NetworkManager:
|
||||
cmd.run:
|
||||
- name: nmcli device set {{ pillar['network']['interface']['bridge'] }} managed yes
|
||||
- unless: bash -c "if [[ \"$(nmcli device show {{ pillar['network']['interface']['bridge'] }} | sed -n 's/^GENERAL.STATE.*(\(.*\)).*$/\1/p')\" == \"unmanaged\" ]]; then exit 1; else exit 0; fi"
|
||||
- name: nmcli device set {{ pillar['network']['bridge'] }} managed yes
|
||||
- unless: bash -c "if [[ \"$(nmcli device show {{ pillar['network']['bridge'] }} | sed -n 's/^GENERAL.STATE.*(\(.*\)).*$/\1/p')\" == \"unmanaged\" ]]; then exit 1; else exit 0; fi"
|
||||
|
||||
Configure {{ pillar['network']['interface']['bridge'] }} connection:
|
||||
Configure {{ pillar['network']['bridge'] }} connection:
|
||||
cmd.run:
|
||||
- name: nmcli connection add con-name {{ pillar['network']['interface']['bridge'] }} type bridge ifname {{ pillar['network']['interface']['bridge'] }} ipv4.method manual ipv4.addresses {{ pillar['network']['ip'] }}/{{ pillar['network']['netmask'] }} ipv4.dns "127.0.0.1, 1.1.1.1, 1.1.1.2" ipv6.method disabled connection.autoconnect yes stp no
|
||||
- unless: nmcli connection show {{ pillar['network']['interface']['bridge'] }} > /dev/null
|
||||
- name: nmcli connection add con-name {{ pillar['network']['bridge'] }} type bridge ifname {{ pillar['network']['bridge'] }} ipv4.method manual ipv4.addresses {{ pillar['network']['ip'] }}/24 ipv4.dns "127.0.0.1, 1.1.1.1, 1.1.1.2" ipv6.method disabled connection.autoconnect yes stp no
|
||||
- unless: nmcli connection show {{ pillar['network']['bridge'] }} > /dev/null
|
||||
|
||||
Add {{ pillar['network']['interface']['internal'] }} to bridge {{ pillar['network']['interface']['bridge'] }}:
|
||||
Add {{ pillar['network']['interface'] }} to bridge {{ pillar['network']['bridge'] }}:
|
||||
cmd.run:
|
||||
- name: nmcli connection add con-name {{ pillar['network']['interface']['bridge'] }}-{{ pillar['network']['interface']['internal'] }} ifname {{ pillar['network']['interface']['internal'] }} type bridge-slave master {{ pillar['network']['interface']['bridge'] }} connection.autoconnect yes
|
||||
- unless: nmcli connection show {{ pillar['network']['interface']['bridge'] }}-{{ pillar['network']['interface']['internal'] }} > /dev/null
|
||||
- name: nmcli connection add con-name {{ pillar['network']['bridge'] }}-{{ pillar['network']['interface'] }} ifname {{ pillar['network']['interface'] }} type bridge-slave master {{ pillar['network']['bridge'] }} connection.autoconnect yes
|
||||
- unless: nmcli connection show {{ pillar['network']['bridge'] }}-{{ pillar['network']['interface'] }} > /dev/null
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user