Hi,

Using Ansible 2.1.0.0 I'm trying to create a bridge br0 on a CentOS 7 host to replace its standard eth0 interface (dhcp). The nmcli examples don't cover a bridge so I tried to follow the logic for bonds. The snippet below does not work, meaning no ifcfg_br0 and ifcfg_br0_slave_1 files are created and nmcli does not show any bridge connections yet Ansible says "changed" when run. Anyone have an idea how to create a bridge using the nmcli module?

TIA,
Patrick

---

 - hosts: test
   become: yes
   become_user: root
   gather_facts: True

   tasks:
   - name: install required NetworkManager packages
     yum:
       name: "{{item}}"
       state: present
     with_items:
       - NetworkManager-glib
       - nm-connection-editor
       - libsemanage-python
       - policycoreutils-python
     tags:
       - setup_br0

   - name: add br0
     nmcli:
       type: bridge
       conn_name: br0
       ifname: br0
       state: present
     tags:
       - setup_br0

   - name: add eth0 to bridge br0
     nmcli:
       type: bridge
       conn_name: br0_slave_1
       ifname: eth0
       master: br0
       state: present
     tags:
       - setup_br0

TASK [install required NetworkManager packages] ******************************** ok: [test] => (item=[u'NetworkManager-glib', u'nm-connection-editor', u'libsemanage-python', u'policycoreutils-python'])

TASK [add br0] *****************************************************************
changed: [test]

TASK [add eth0 to bridge br0] **************************************************
changed: [test]

PLAY RECAP *********************************************************************
test      : ok=4    changed=2    unreachable=0    failed=0


[root@test network-scripts]# ls -l | grep br0
[root@test network-scripts]#

[root@test network-scripts]# nmcli con show
NAME         UUID                                  TYPE            DEVICE
eth0         e6a5de4e-cf70-4093-a907-9673c782266d  802-3-ethernet  eth0

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d4bacfb0-bdde-1dee-df7c-ccac91a9ef36%40laimbock.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to