Note
This module is part of the community.general collection (version 10.7.3).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.systemd_creds_encrypt.
New in community.general 10.2.0
systemd‘s systemd-creds encrypt.Parameter | Comments |
|---|---|
name string | The credential name to embed in the encrypted credential data. |
not_after string | The time when the credential shall not be used anymore. Takes a timestamp specification in the format described in |
pretty boolean | Pretty print the output so that it may be pasted directly into a unit file. Choices:
|
secret string / required | The secret to encrypt. |
timestamp string | The timestamp to embed into the encrypted credential. Takes a timestamp specification in the format described in |
user string | A user name or numeric UID to encrypt the credential for. If set to the special string Requires |
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full This action does not modify state. | Can run in |
diff_mode | Support: N/A This action does not modify state. | Will return details on what has changed (or possibly needs changing in |
Note
systemd-creds requires systemd 250 or later.- name: Encrypt secret
become: true
community.general.systemd_creds_encrypt:
name: db
not_after: +48hr
secret: access_token
register: encrypted_secret
- name: Print the encrypted secret
ansible.builtin.debug:
msg: "{{ encrypted_secret }}"
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
value string | The Base64 encoded encrypted secret. Returned: always Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/systemd_creds_encrypt_module.html