mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-28 07:31:23 -07:00
docker_swarm_service: Add read_only option (#53482)
* Add read_only option * Add changelog fragment * Add version_added * Fix broken test
This commit is contained in:
parent
13ab9a61a8
commit
f5faf8211d
4 changed files with 72 additions and 0 deletions
|
@ -1820,6 +1820,58 @@
|
|||
- "'Minimum version required' in publish_1.msg"
|
||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('3.0.0', '<')
|
||||
|
||||
###################################################################
|
||||
## read_only ######################################################
|
||||
###################################################################
|
||||
|
||||
- name: read_only
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
read_only: true
|
||||
register: read_only_1
|
||||
ignore_errors: yes
|
||||
|
||||
- name: read_only (idempotency)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
read_only: true
|
||||
register: read_only_2
|
||||
ignore_errors: yes
|
||||
|
||||
- name: read_only (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
read_only: false
|
||||
register: read_only_3
|
||||
ignore_errors: yes
|
||||
|
||||
- name: cleanup
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
state: absent
|
||||
diff: no
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- read_only_1 is changed
|
||||
- read_only_2 is not changed
|
||||
- read_only_3 is changed
|
||||
when: docker_api_version is version('1.28', '>=') and docker_py_version is version('2.6.0', '>=')
|
||||
- assert:
|
||||
that:
|
||||
- read_only_1 is failed
|
||||
- "'Minimum version required' in read_only_1.msg"
|
||||
when: docker_api_version is version('1.28', '<') or docker_py_version is version('2.6.0', '<')
|
||||
|
||||
###################################################################
|
||||
## replicas #######################################################
|
||||
###################################################################
|
||||
|
|
|
@ -33,6 +33,7 @@ service_expected_output:
|
|||
publish:
|
||||
- {mode: null, protocol: tcp, published_port: 60001, target_port: 60001}
|
||||
- {mode: null, protocol: udp, published_port: 60001, target_port: 60001}
|
||||
read_only: null
|
||||
replicas: null
|
||||
reserve_cpu: null
|
||||
reserve_memory: null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue