Repository: ansible-collections/community.general

Issue:
nmcli unable to create bridge slave
It appears this was reported here but closed with no resolution. 
https://github.com/ansible/ansible/issues/42460

##### SUMMARY
Attempting to add slave bridge results in error:
Error: invalid or not allowed setting 'ipv6': 'ipv6' not among [connection, 802-3-ethernet (ethernet), 802-1x, dcb, bridge-port].\n

```
- name: create bridge interface
  community.general.nmcli:
    conn_name: Bridge connection 1
    ifname: bridge0
    type: bridge
    state: present
    stp: no
  become: yes
- name: create bridge interface slave
  community.general.nmcli:
    conn_name: bridge0 slave 1
    ifname: enx00e04c05510f
    type: bridge-slave
    master: bridge0
    state: present
    stp: no
  become: yes
```

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
nmcli

##### ANSIBLE VERSION

```
2.9.6
```

##### CONFIGURATION
```
```
No output???

##### OS / ENVIRONMENT
Ubuntu 18.04 Desktop


##### STEPS TO REPRODUCE
```
- name: create bridge interface
  community.general.nmcli:
    conn_name: Bridge connection 1
    ifname: bridge0
    type: bridge
    state: present
    stp: no
  become: yes
- name: create bridge interface slave
  community.general.nmcli:
    conn_name: bridge0 slave 1
    ifname: enx00e04c05510f
    type: bridge-slave
    master: bridge0
    state: present
    stp: no
  become: yes
```

##### EXPECTED RESULTS
1. bridge gets created
2. bridge contains slave device

##### ACTUAL RESULTS
1. bridge gets created
2. slave fails with above error message
Here is the output of the above tasks, when passed to the wrapper I made for nmcli to capture the actual parameters that got passed to it.

Please note that second invocation contains ipv6 and ipv4 settings, although they were not explicitly specified. 

```
Executing: nmcli --fields name --terse con show
Exited: 0
Executing: nmcli con show Bridge connection 1
Exited: 10
Executing: nmcli con modify Bridge connection 1 connection.interface-name bridge0 ipv6.dns-search  ipv4.dns-search  bridge.ageing-time 300 connection.autoconnect yes bridge.forward-delay 15 bridge.stp no bridge.hello-time 2 bridge.priority 128 ipv6.dns  ipv4.dns  bridge.max-age 20
Exited: 10
Executing: nmcli --fields name --terse con show
Exited: 0
Executing: nmcli --fields name --terse con show
Exited: 0
Executing: nmcli con show bridge0 slave 1
Exited: 10
Executing: nmcli con modify bridge0 slave 1 connection.interface-name enx00e04c05510f ipv6.dns-search  connection.master bridge0 ipv4.dns-search  connection.autoconnect yes bridge-port.priority 32 bridge-port.path-cost 100 bridge-port.hairpin-mode yes ipv6.dns  ipv4.dns 
Exited: 10
Executing: nmcli --fields name --terse con show
Exited: 0
```


Discussion:
Files identified in the description:
* [`plugins/modules/net_tools/nmcli.py`](https://github.com/ansible-collections/community.general/blob/master/plugins/modules/net_tools/nmcli.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @alcamie101 @nerzhul
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
Additional observation: it appears that the module is not able to handle connections with space in the connection profile name. (error code 10)

Resolving patch:
diff --git a/plugins/modules/net_tools/nmcli.py b/plugins/modules/net_tools/nmcli.py
--- a/plugins/modules/net_tools/nmcli.py
+++ b/plugins/modules/net_tools/nmcli.py
@@ -781,7 +781,6 @@ def ip_conn_type(self):
         return self.type in (
             'bond',
             'bridge',
-            'bridge-slave',
             'ethernet',
             'generic',
             'infiniband',


Test patch: