Skip to content

Commit ef99e1f

Browse files
committed
Test the dest option in the systemd_creds_encrypt
1 parent 4e1b232 commit ef99e1f

File tree

1 file changed

+23
-0
lines changed
  • tests/integration/targets/systemd_creds_encrypt/tasks

1 file changed

+23
-0
lines changed

tests/integration/targets/systemd_creds_encrypt/tasks/main.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,26 @@
5353
- '"SetCredentialEncrypted=web: " in pretty_encrypted_secret.value'
5454
fail_msg: "SetCredentialEncrypted is not in the output"
5555
success_msg: "SetCredentialEncrypted is in the output"
56+
57+
- name: Ensure the dest file doesn't already exist
58+
ansible.builtin.file:
59+
path: /tmp/systemd_cred_enctypt_test_secret.cred
60+
state: absent
61+
62+
- name: Encrypt secret into the dest file
63+
community.general.systemd_creds_encrypt:
64+
name: web
65+
secret: token
66+
dest: /tmp/systemd_cred_enctypt_test_secret.cred
67+
68+
- name: Check if the dest file exists
69+
stat:
70+
path: /tmp/systemd_cred_enctypt_test_secret.cred
71+
register: dest_file
72+
73+
- name: Assert that the dest file exists
74+
ansible.builtin.assert:
75+
that:
76+
- "dest_file.stats.exists"
77+
fail_msg: "The dest file doesn't exist"
78+
success_msg: "The dest file does exist"

0 commit comments

Comments
 (0)