# Issue with nmcli command

**URL:** <https://forum.ansible.com/t/issue-with-nmcli-command/30909>\
**Category:** Ansible Project\
**Created:** [July 30, 2019, 8:08pm UTC](https://forum.ansible.com/t/issue-with-nmcli-command/30909 "2019-07-30T20:08:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [July 30, 2019, 8:08pm UTC](https://forum.ansible.com/t/issue-with-nmcli-command/30909/1 "2019-07-30T20:08:29Z")

</div>

We have a playbook where we are trying to create a bonded interface between 2 physical interfaces. We are specifying the connection name (conn\_name) but we get errors stating that the interface file could not be found. For example, one of the interfaces is eno2, so the interface should be /etc/sysconfig/network-scripts/ifcfg-eno2, however, Ansible is looking for /etc/sysconfig/network-scripts/ifcfg-eno2-1, which doesn’t exist.

Here’s the error:

TASK [Create the bond-slave interfaces] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

failed: [server1] (item={u’conn\_name’: u’enp216s0f1’, u’ifname’: u’enp216s0f1’, u’master’: u’bond1’}) =\> {“ansible\_loop\_var”: “item”, “changed”: false, “item”: {“conn\_name”: “enp216s0f1”, “ifname”: “enp216s0f1”, “master”: “bond1”}, “msg”: “Error: Failed to modify connection ‘enp216s0f1’: Could not read file ‘/etc/sysconfig/network-scripts/ifcfg-enp216s0f1-1’: No such file or directory\n”, “name”: “enp216s0f1”, “rc”: 1}

failed: [server2] (item={u’conn\_name’: u’enp216s0f1’, u’ifname’: u’enp216s0f1’, u’master’: u’bond1’}) =\> {“ansible\_loop\_var”: “item”, “changed”: false, “item”: {“conn\_name”: “enp216s0f1”, “ifname”: “enp216s0f1”, “master”: “bond1”}, “msg”: “Error: Failed to modify connection ‘enp216s0f1’: connection.slave-type: Cannot set ‘master’ without ‘slave-type’\n”, “name”: “enp216s0f1”, “rc”: 1}

failed: [server1] (item={u’conn\_name’: u’eno2’, u’ifname’: u’eno2’, u’master’: u’bond1’}) =\> {“ansible\_loop\_var”: “item”, “changed”: false, “item”: {“conn\_name”: “eno2”, “ifname”: “eno2”, “master”: “bond1”}, “msg”: “Error: Failed to modify connection ‘eno2’: Could not read file ‘/etc/sysconfig/network-scripts/ifcfg-eno2-1’: No such file or directory\n”, “name”: “eno2”, “rc”: 1}

failed: [server2] (item={u’conn\_name’: u’eno2’, u’ifname’: u’eno2’, u’master’: u’bond1’}) =\> {“ansible\_loop\_var”: “item”, “changed”: false, “item”: {“conn\_name”: “eno2”, “ifname”: “eno2”, “master”: “bond1”}, “msg”: “Error: Failed to modify connection ‘eno2’: Could not read file ‘/etc/sysconfig/network-scripts/ifcfg-eno2-1’: No such file or directory\n”, “name”: “eno2”, “rc”: 1}

Here’s how we have the variables setup that the playbook uses:

pre\_tasks:

- setup:

filter: ‘ansible\_default\_ipv4’

vars:

- bond\_interface:

- conn\_name: bond1

ip4: 192.168.99.{{ansible\_default\_ipv4.address.split(‘.’)[3] }}

gw4: 192.168.99.1

mode: 802.3ad

mtu: 9000

- bond\_slave:

- conn\_name: enp216s0f1

ifname: enp216s0f1

master: bond1

- conn\_name: eno2

ifname: eno2

master: bond1

- name: Create bond1 interface  
nmcli:  
conn\_name: ‘{{ item.conn\_name }}’  
ip4: ‘{{ item.ip4 }}’  
gw4: ‘{{ item.gw4 }}’  
mode: ‘{{ item.mode }}’  
mtu: ‘{{ item.mtu }}’  
type: bond  
state: present  
with\_items:

- ‘{{ bond\_interface }}’

- name: Create the bond-slave interfaces  
nmcli:  
type: bond-slave  
conn\_name: ‘{{ item.conn\_name }}’  
ifname: ‘{{ item.ifname }}’  
master: ‘{{ item.master }}’  
state: present  
with\_items:

- ‘{{ bond\_slave }}’

It appears as though the conn\_name for the bond\_slave play is being ignored. The docs state for conn\_name: Where conn\_name will be the name used to call the connection. when not provided a default name is generated: [-][-].

Any ideas?  
Harry
