Setup wifi with private key

Hi Community

I need some hints on how to setup a wifi connection with ansible. And in my case use a private key to authenticate with.

The task below is what i come up with so far but how do I add a private key and password for the connection?

- name: DEV WiFi
  community.general.nmcli:
    type: wifi
    conn_name: DEV Wifi
    ifname: "*"
    ssid: dev_wifi
    wifi_sec:
      psk: my_password
      key-mgmt: wpa-eap
      proto: wpa
    autoconnect: false
    state: present

I have attached this image also for clarification for which fields I talk about “User private key” and “User key password” and perhaps also “Identity”

  • Please help in how to achieve this.
  • is .pki/nssdb involved in this?

ansible-playbook [core 2.15.8]
ubuntu 22.04

BR
/Daniel

hi i’m a bit confused about what you want to configure? do you want to use wpa enterprise with tls certificates? if so then:

  • why would you specify a psk password in your play?
  • i don’t see any options to properly configure a wpa enterprise connection in the documentation of the nmcli module
  • why don’t you just use the file or template modules to copy a proper configuration file to the host and restart the service?
1 Like