[2.7] Fix advertise addr (#48405)
* Fix advertise addr (#47608)
* Fix issue #46326
* Update example to create a default swarm
(cherry picked from commit 87de2dde9f
)
* Add changelog.
This commit is contained in:
parent
6b13127830
commit
33ccd3b78d
3 changed files with 6 additions and 15 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- "docker_swarm - making ``advertise_addr`` optional, as it was already documented."
|
|
@ -151,7 +151,6 @@ EXAMPLES = '''
|
||||||
- name: Init a new swarm with default parameters
|
- name: Init a new swarm with default parameters
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
state: present
|
state: present
|
||||||
advertise_addr: 192.168.1.1
|
|
||||||
|
|
||||||
- name: Update swarm configuration
|
- name: Update swarm configuration
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
|
@ -330,9 +329,6 @@ class SwarmManager(DockerBaseClass):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.parameters.advertise_addr is None:
|
|
||||||
self.client.fail(msg="advertise_addr is required to initialize a swarm cluster.")
|
|
||||||
|
|
||||||
self.client.init_swarm(
|
self.client.init_swarm(
|
||||||
advertise_addr=self.parameters.advertise_addr, listen_addr=self.parameters.listen_addr,
|
advertise_addr=self.parameters.advertise_addr, listen_addr=self.parameters.listen_addr,
|
||||||
force_new_cluster=self.parameters.force_new_cluster, swarm_spec=self.parameters.spec)
|
force_new_cluster=self.parameters.force_new_cluster, swarm_spec=self.parameters.spec)
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
- name: Test parameters with state=present
|
- name: Make sure we're not already using Docker swarm
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
state: present
|
state: absent
|
||||||
ignore_errors: yes
|
force: true
|
||||||
register: output
|
|
||||||
|
|
||||||
- name: assert failure when called with state=init and no advertise_addr
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- 'output.failed'
|
|
||||||
- 'output.msg == "advertise_addr is required to initialize a swarm cluster."'
|
|
||||||
|
|
||||||
- name: Test parameters with state=join
|
- name: Test parameters with state=join
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
|
@ -37,7 +30,6 @@
|
||||||
- name: Create a Swarm cluster
|
- name: Create a Swarm cluster
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
state: present
|
state: present
|
||||||
advertise_addr: "{{ansible_default_ipv4.address}}"
|
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: assert changed when create a new swarm cluster
|
- name: assert changed when create a new swarm cluster
|
||||||
|
|
Loading…
Reference in a new issue