Documentation

    PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.19

    Documentation for other releases can be found by using the version selector in the top right of any doc page.

    nmcli

    Manage NetworkManager connections using nmcli.

    Attributes

    check_mode:
      support: full
    

    Parameters

    Parameter Required Type Values Description
    autoconnect   boolean    
    conn_name true string    
    dns4   array    
    gw4   string    
    ifname   string    
    ip4   string    
    ssid   string    
    state   string present
    absent
    up
    down
     
    type   string ethernet
    wifi
    bridge
    bond
    team
    vlan
    vxlan
    dummy
    generic
    tun
    veth
     
    wifi_sec   object    

    Example

    - name: Create ethernet connection with static IP
      nmcli:
        conn_name: eth0-static
        ifname: eth0
        type: ethernet
        ip4: 192.168.1.100/24
        gw4: 192.168.1.1
        dns4:
          - 8.8.8.8
          - 8.8.4.4
        state: present
    
    - name: Bring up a connection
      nmcli:
        conn_name: eth0-static
        state: up
    
    - name: Bring down a connection
      nmcli:
        conn_name: eth0-static
        state: down
    
    - name: Delete a connection
      nmcli:
        conn_name: eth0-static
        state: absent
    
    - name: Create WiFi connection
      nmcli:
        conn_name: mywifi
        type: wifi
        ifname: wlan0
        ssid: MyNetwork
        wifi_sec:
          key-mgmt: wpa-psk
          psk: mypassword
        state: present
    
    - name: Create a bridge connection
      nmcli:
        conn_name: br0
        type: bridge
        ifname: br0
        ip4: 192.168.1.10/24
        state: present