docker_config and docker_secret: add data_src option (#203)

* Add data_src options to docker_config and docker_secret.

* Add examples.

* Fix test.

* Another fix.
This commit is contained in:
Felix Fontein
2021-09-12 09:42:03 +02:00
committed by GitHub
parent 668f77d7d2
commit 5d861004db
7 changed files with 99 additions and 6 deletions
@@ -1,3 +1,4 @@
---
dependencies:
- setup_docker
- setup_remote_tmp_dir
@@ -37,7 +37,7 @@
assert:
that:
- 'output.failed'
- 'output.msg == "state is present but all of the following are missing: data"'
- 'output.msg == "state is present but any of the following are missing: data, data_src"'
- name: Create config
docker_config:
@@ -80,6 +80,24 @@
that:
- not output.changed
- name: Write config into file
copy:
dest: "{{ remote_tmp_dir }}/data"
content: |-
opensesame!
- name: Create config again (from file)
docker_config:
name: db_password
data_src: "{{ remote_tmp_dir }}/data"
state: present
register: output
- name: assert create config is idempotent
assert:
that:
- not output.changed
- name: Create config again (base64)
docker_config:
name: db_password
@@ -1,3 +1,4 @@
---
dependencies:
- setup_docker
- setup_remote_tmp_dir
@@ -33,7 +33,7 @@
assert:
that:
- 'output.failed'
- 'output.msg == "state is present but all of the following are missing: data"'
- 'output.msg == "state is present but any of the following are missing: data, data_src"'
- name: Create secret
docker_secret:
@@ -76,6 +76,24 @@
that:
- not output.changed
- name: Write secret into file
copy:
dest: "{{ remote_tmp_dir }}/data"
content: |-
opensesame!
- name: Create secret again (from file)
docker_secret:
name: db_password
data_src: "{{ remote_tmp_dir }}/data"
state: present
register: output
- name: assert create secret is idempotent
assert:
that:
- not output.changed
- name: Create secret again (base64)
docker_secret:
name: db_password