kravietz.wpa_supplicant

Role Name

=========

This role helps manage the configuration of wpa_supplicant with all options and supports systemd.

Requirements


No special requirements.

Role Variables


Most variables (except the first one) match the options found in the wpa_supplicant.conf reference. The configuration file is created by converting the Ansible dictionary variables (like country: GB) into variables for the configuration file (like country=GB). Some variables need to be in quotes, so for example, you would write username: '"[email protected]"' in Ansible.

This option indicates which interface wpa_supplicant will use:

wpa_supplicant_interface: wlan0

Here are some global configuration options for wpa_supplicant:

wpa_supplicant_config:
  update_config: 1
  country: GB

You can have many credential blocks:

wpa_supplicant_credentials:
  - realm: '"example.com"'
    username: '"[email protected]"'

You can also have multiple network blocks:

wpa_supplicant_networks:
  - scan_ssid: 1
    ssid: '"MySSID"'
    key_mgmt: WPA-PSK
    psk: '"Kohjioqu5Iefae1iedee"'

The psk (pre-shared key) should be encrypted with ansible-vault, or even better, hashed using the wpa_passphrase utility, and then it doesn't need quotes.

Dependencies


You can use this role with shibumi.systemd-conf to manage the network configuration completely through Ansible:

systemd_conf_network:
  10-wlan:
    - Match:
        - Name: wlan0
    - Network:
        - Address: '192.168.1.251/24'
        - Gateway: '192.168.1.252'

Example Playbook


This is an example playbook assuming the configuration is set in host_vars:

- hosts: access_point
  roles:
    - role: kravietz.wpa_supplicant
      wpa_supplicant_interface: wlan0
      wpa_supplicant_config:
        ctrl_interface: DIR=/var/run/wpa_supplicant GROUP=netdev
        country: GB
      wpa_supplicant_networks:
        - scan_ssid: 1
          ssid: '"TEST"'
          psk: '"TEST-TEST-TEST"'
          key_mgmt: WPA-PSK
    - role: shibumi.systemd-conf

License


GPLv3

Author Information


Paweł Krawczyk Website

Informazioni sul progetto

wpa_supplicant management configuration with all options and systemd support.

Installa
ansible-galaxy install kravietz.wpa_supplicant
Licenza
gpl-3.0
Download
634
Proprietario
Information security, DevOps and DevSecOps professional from Poland living in the UK