I too am having the same issue.

Using Fedora 25 with Ansible 2.2.1.0 to change network settings on Centos 7 
64bit.

This is what I did.

What am I missing?

----------- start -------------------------
---
- hosts: test
  user: root

  tasks:
    - name: yum upgrade all packages.
      yum: name=* state=latest

    - name: install needed network manager libs
      yum:
        name: '{{ item }}'
        state: installed
      with_items:
        - NetworkManager-glib
        - nm-connection-editor
        - libsemanage-python
        - policycoreutils-python
        - bridge-utils

    - name: setup network bridge
      nmcli:
        conn_name: br0
        ifname: br0
        type: bridge
        ip4: 10.0.0.42/24
        gw4: 10.0.0.1
        state: present

    - name: setup ethernet interface
      nmcli:
        conn_name: eth0
        ifname: eth0
        master: br0
        state: present
----------- end --------------------------

On Wednesday, July 13, 2016 at 12:53:01 AM UTC+8, Patrick Laimbock wrote:
>
> 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/55b86051-cd55-4169-9d43-e590e3b2ec39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to