mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Updating docker_network module proposal.
This commit is contained in:
parent
76766aac8b
commit
d85589121e
1 changed files with 38 additions and 48 deletions
|
@ -15,39 +15,15 @@ Docker_network will accept the parameters listed below. Parameters related to co
|
||||||
a shared utility module, as mentioned above.
|
a shared utility module, as mentioned above.
|
||||||
|
|
||||||
```
|
```
|
||||||
containers:
|
|
||||||
|
|
||||||
network_name:
|
|
||||||
description:
|
|
||||||
- Name of the network to operate on.
|
|
||||||
default: null
|
|
||||||
required: true
|
|
||||||
|
|
||||||
driver:
|
|
||||||
description:
|
|
||||||
- Specify the type of network. Docker provides bridge and overlay drivers, but 3rd party drivers can also be used.
|
|
||||||
default: bridge
|
|
||||||
|
|
||||||
options:
|
|
||||||
description:
|
|
||||||
- Dictionary of network settings. Consult docker docs for valid options and values.
|
|
||||||
default: null
|
|
||||||
|
|
||||||
connected:
|
connected:
|
||||||
description:
|
description:
|
||||||
- List of container names or container IDs to connect to a network.
|
- List of container names or container IDs to connect to a network.
|
||||||
default: null
|
default: null
|
||||||
|
|
||||||
disconnected:
|
driver:
|
||||||
description:
|
description:
|
||||||
- List of container names or container IDs to disconnect from a network.
|
- Specify the type of network. Docker provides bridge and overlay drivers, but 3rd party drivers can also be used.
|
||||||
default: null
|
default: bridge
|
||||||
|
|
||||||
disconnect_all:
|
|
||||||
description:
|
|
||||||
- Disconnect all containers, unless the containers is in the provided list of connected containers. If no
|
|
||||||
list of connected containers is provided, all containers will be disconnnected.
|
|
||||||
default: false
|
|
||||||
|
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
|
@ -55,20 +31,35 @@ force:
|
||||||
state 'present' will disconnect all containers, delete the network and re-create the network.
|
state 'present' will disconnect all containers, delete the network and re-create the network.
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
|
incremental:
|
||||||
|
description:
|
||||||
|
- By default the connected list is canonical, meaning containers not on the list are removed from the network.
|
||||||
|
Use incremental to leave existing containers connected.
|
||||||
|
default: false
|
||||||
|
|
||||||
|
network_name:
|
||||||
|
description:
|
||||||
|
- Name of the network to operate on.
|
||||||
|
default: null
|
||||||
|
required: true
|
||||||
|
|
||||||
|
options:
|
||||||
|
description:
|
||||||
|
- Dictionary of network settings. Consult docker docs for valid options and values.
|
||||||
|
default: null
|
||||||
|
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- "absent" deletes the network. If a network has connected containers, it cannot be deleted. Use the force option
|
- "absent" deletes the network. If a network has connected containers, it cannot be deleted. Use the force option
|
||||||
to disconnect all containers and delete the network.
|
to disconnect all containers and delete the network.
|
||||||
- "present" creates the network, if it does not already exist with the specified parameters, and connects the list
|
- "present" creates the network, if it does not already exist with the specified parameters, and connects the list
|
||||||
of containers provided via the connected parameter. Use disconnected to remove a set of containers from the
|
of containers provided via the connected parameter. Containers not on the list will be disconnected. An empty
|
||||||
network. Use disconnect_all to remove from the network any containers not included in the containers parameter.
|
list will leave no containers connected to the network. Use the incremental option to leave existing containers
|
||||||
If disconnected is provided with no list of connected parameter, all containers will be removed from the
|
connected. Use the force options to force re-creation of the network.
|
||||||
network. Use the force options to force the re-creation of the network.
|
|
||||||
default: present
|
default: present
|
||||||
choices:
|
choices:
|
||||||
- absent
|
- absent
|
||||||
- present
|
- present
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,27 +76,21 @@ state:
|
||||||
connected:
|
connected:
|
||||||
- containera
|
- containera
|
||||||
- containerb
|
- containerb
|
||||||
disconnect_all: yes
|
- containerc
|
||||||
|
|
||||||
- name: Remove a container from the network
|
- name: Remove a single container
|
||||||
docker_network:
|
docker_network:
|
||||||
name: network_one
|
name: network_one
|
||||||
disconnected:
|
connected: "{{ fulllist|difference(['containera']) }}"
|
||||||
- containerb
|
|
||||||
|
|
||||||
- name: Delete a network, disconnected all containers
|
- name: Add a container to a network, leaving existing containers connected
|
||||||
docker_network:
|
|
||||||
name: network_one
|
|
||||||
state: absent
|
|
||||||
force: yes
|
|
||||||
|
|
||||||
- name: Add a container to a network
|
|
||||||
docker_network:
|
docker_network:
|
||||||
name: network_one
|
name: network_one
|
||||||
connected:
|
connected:
|
||||||
- containerc
|
- containerc
|
||||||
|
incremental: yes
|
||||||
|
|
||||||
- name: Create a network with options (Not sure if 'ip_range' is correct name)
|
- name: Create a network with options (Not sure if 'ip_range' is correct key name)
|
||||||
docker_network
|
docker_network
|
||||||
name: network_two
|
name: network_two
|
||||||
options:
|
options:
|
||||||
|
@ -113,6 +98,11 @@ state:
|
||||||
gateway: 172.3.26.1
|
gateway: 172.3.26.1
|
||||||
ip_range: '192.168.1.0/24'
|
ip_range: '192.168.1.0/24'
|
||||||
|
|
||||||
|
- name: Delete a network, disconnecting all containers
|
||||||
|
docker_network:
|
||||||
|
name: network_one
|
||||||
|
state: absent
|
||||||
|
force: yes
|
||||||
```
|
```
|
||||||
|
|
||||||
## Returns:
|
## Returns:
|
||||||
|
|
Loading…
Reference in a new issue