mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.3 KiB
YAML
94 lines
2.3 KiB
YAML
6 years ago
|
---
|
||
|
|
||
|
- name: Remove Swarm cluster
|
||
|
docker_swarm:
|
||
|
state: absent
|
||
|
force: true
|
||
|
diff: yes
|
||
|
register: output_2
|
||
|
|
||
|
####################################################################
|
||
|
## default_addr_pool ###############################################
|
||
|
####################################################################
|
||
|
|
||
|
- name: default_addr_pool
|
||
|
docker_swarm:
|
||
|
state: present
|
||
|
default_addr_pool:
|
||
|
- "2.0.0.0/16"
|
||
|
diff: yes
|
||
|
register: output_1
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: default_addr_pool (idempotent)
|
||
|
docker_swarm:
|
||
|
state: present
|
||
|
default_addr_pool:
|
||
|
- "2.0.0.0/16"
|
||
|
diff: yes
|
||
|
register: output_2
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: cleanup
|
||
|
docker_swarm:
|
||
|
state: absent
|
||
|
force: true
|
||
|
diff: no
|
||
|
|
||
|
- name: assert default_addr_pool
|
||
|
assert:
|
||
|
that:
|
||
|
- 'output_1 is changed'
|
||
|
- 'output_2 is not changed'
|
||
|
- 'output_2.swarm_facts.DefaultAddrPool == ["2.0.0.0/16"]'
|
||
|
when: docker_api_version is version('1.39', '>=') and docker_py_version is version('4.0.0', '>=')
|
||
|
|
||
|
- name: assert default_addr_pool failed when unsupported
|
||
|
assert:
|
||
|
that:
|
||
|
- 'output_1 is failed'
|
||
|
- "'Minimum version required' in output_1.msg"
|
||
|
when: docker_api_version is version('1.39', '<') or docker_py_version is version('4.0.0', '<')
|
||
|
|
||
|
####################################################################
|
||
|
## subnet_size #####################################################
|
||
|
####################################################################
|
||
|
|
||
|
- name: subnet_size
|
||
|
docker_swarm:
|
||
|
state: present
|
||
|
force: yes
|
||
|
subnet_size: 26
|
||
|
diff: yes
|
||
|
register: output_1
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: subnet_size (idempotent)
|
||
|
docker_swarm:
|
||
|
state: present
|
||
|
subnet_size: 26
|
||
|
diff: yes
|
||
|
register: output_2
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: assert subnet_size
|
||
|
assert:
|
||
|
that:
|
||
|
- 'output_1 is changed'
|
||
|
- 'output_2 is not changed'
|
||
|
- 'output_2.swarm_facts.SubnetSize == 26'
|
||
|
when: docker_api_version is version('1.39', '>=') and docker_py_version is version('4.0.0', '>=')
|
||
|
|
||
|
- name: cleanup
|
||
|
docker_swarm:
|
||
|
state: absent
|
||
|
force: true
|
||
|
diff: no
|
||
|
|
||
|
- name: assert subnet_size failed when unsupported
|
||
|
assert:
|
||
|
that:
|
||
|
- output_1 is failed
|
||
|
- "'Minimum version required' in output_1.msg"
|
||
|
when: docker_api_version is version('1.39', '<') or docker_py_version is version('4.0.0', '<')
|