mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-30 07:50:43 +00:00
docker_swarm_service: Add placement_preferences option (#51082)
* Add placement_preferences option * Add changelog fragment * Python 2.6 compat Python 2.6 compat * Cleaner check * Better description * Don’t compare placement_preferences if None * Add placement_preferences example
This commit is contained in:
parent
552cb1f6b9
commit
393bf5e4b1
4 changed files with 82 additions and 3 deletions
|
|
@ -950,6 +950,46 @@
|
|||
- networks_2 is not changed
|
||||
- networks_3 is changed
|
||||
|
||||
####################################################################
|
||||
## placement_preferences ###########################################
|
||||
####################################################################
|
||||
|
||||
- name: placement_preferences
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
placement_preferences:
|
||||
- spread: "node.labels.test"
|
||||
register: placement_preferences_1
|
||||
|
||||
- name: placement_preferences (idempotency)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
placement_preferences:
|
||||
- spread: "node.labels.test"
|
||||
register: placement_preferences_2
|
||||
|
||||
- name: placement_preferences (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
placement_preferences:
|
||||
- spread: "node.labels.test2"
|
||||
register: placement_preferences_3
|
||||
|
||||
- name: cleanup
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
state: absent
|
||||
diff: no
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- placement_preferences_1 is changed
|
||||
- placement_preferences_2 is not changed
|
||||
- placement_preferences_3 is changed
|
||||
|
||||
####################################################################
|
||||
## publish #########################################################
|
||||
####################################################################
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ service_expected_output:
|
|||
mode: global
|
||||
mounts: []
|
||||
networks: []
|
||||
placement_preferences: null
|
||||
publish:
|
||||
- {mode: null, protocol: tcp, published_port: 60001, target_port: 60001}
|
||||
- {mode: null, protocol: udp, published_port: 60001, target_port: 60001}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue