2018-10-29 22:34:00 +01:00
|
|
|
---
|
|
|
|
- name: Registering container and network names
|
|
|
|
set_fact:
|
|
|
|
nname_1: "{{ name_prefix ~ '-network-foo' }}"
|
|
|
|
nname_2: "{{ name_prefix ~ '-network-foobar' }}"
|
|
|
|
- name: Registering container and network names
|
|
|
|
set_fact:
|
2019-05-31 23:47:53 +02:00
|
|
|
dnetworks: "{{ dnetworks + [nname_1, nname_2] }}"
|
2018-10-29 22:34:00 +01:00
|
|
|
|
|
|
|
####################################################################
|
|
|
|
|
|
|
|
- name: Create network (superstring)
|
|
|
|
docker_network:
|
|
|
|
name: "{{ nname_2 }}"
|
|
|
|
state: present
|
|
|
|
register: networks_1
|
|
|
|
|
|
|
|
- name: Create network (substring)
|
|
|
|
docker_network:
|
|
|
|
name: "{{ nname_1 }}"
|
|
|
|
state: present
|
|
|
|
register: networks_2
|
|
|
|
|
|
|
|
- name: Cleanup
|
|
|
|
docker_network:
|
|
|
|
name: "{{ network_name }}"
|
|
|
|
state: absent
|
|
|
|
loop:
|
|
|
|
- "{{ nname_1 }}"
|
|
|
|
- "{{ nname_2 }}"
|
|
|
|
loop_control:
|
|
|
|
loop_var: network_name
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- networks_1 is changed
|
|
|
|
- networks_2 is changed
|