mirror of https://github.com/ansible/ansible.git
docker_swarm: Add support for default_addr_pool and subnet_size (#54642)
* Add support for default_addr_pool and subnet_size * Add changelog fragment * Document options only used on init / joinpull/54695/head
parent
26d9341891
commit
833512b07c
@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- "docker_swarm - Added support for ``default_addr_pool`` and ``subnet_size``."
|
@ -0,0 +1,93 @@
|
||||
---
|
||||
|
||||
- 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', '<')
|
Loading…
Reference in New Issue