# Setup wifi with private key

**URL:** <https://forum.ansible.com/t/setup-wifi-with-private-key/3366>\
**Category:** Get Help\
**Tags:** openssl, ubuntu, network\
**Created:** [January 18, 2024, 8:24am UTC](https://forum.ansible.com/t/setup-wifi-with-private-key/3366 "2024-01-18T08:24:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lfvdaniel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/lfvdaniel/32/2022_2.png) [@lfvdaniel](https://forum.ansible.com/u/lfvdaniel)\
**Post date:** [January 18, 2024, 8:24am UTC](https://forum.ansible.com/t/setup-wifi-with-private-key/3366/1 "2024-01-18T08:24:00Z")

</div>

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?

```auto
- 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?

 ![Screenshot from 2024-01-18 08-57-04](https://us1.discourse-cdn.com/ansible/original/2X/9/9f2e43a454f01c66874f9c791daf1a9e885b7dff.png)

ansible-playbook [core 2.15.8]  
ubuntu 22.04

BR  
/Daniel

---

<div class="post-metadata">

**Author:** ![Molecule4232](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@Molecule4232](https://forum.ansible.com/u/Molecule4232)\
**Post date:** [February 23, 2024, 1:51am UTC](https://forum.ansible.com/t/setup-wifi-with-private-key/3366/2 "2024-02-23T01:51:48Z")

</div>

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?
