ansible / ansible-rulebook

Apache License 2.0
195 stars 76 forks source link

Support Ansible Vault #484

Open vkrizan opened 1 year ago

vkrizan commented 1 year ago

Please confirm the following

Feature type

New Feature

Feature Summary

Please add support for Ansible Vault.

Steps to reproduce

# Plaintext YAML file
$ cat secrets_file.enc
webhook_token: SuperSecretToken

# Encrypt the file with ansible-vault
$ ansible-vault encrypt secrets_file.enc
New Vault password:
Confirm New Vault password:
Encryption successful
# Rulebook
$ cat secrets-rulebook.yaml
- name: secrets example
  hosts: all
  sources:
    - ansible.eda.webhook:
        token: "{{ webhook_token }}"
$ ansible-rulebook --rulebook secrets-example.yml -i inventory.yml -e @secrets_file.enc

Current results

Variables are currently only read from a clear-text yaml files.

Sugested feature result

Support for secure use of sensitive data.

Additional information

Thank you.

SuchitraVenugopal123 commented 1 year ago

Is this support available now ? While reading encrypted secrets it throw the error as

0-05:00 2023-10-27 13:08:12,241 - ansible_rulebook.cli - ERROR - Terminating could not determine a constructor for the tag '!vault' 2023-10-27T08:08:12.246785590-05:00 in "", line 4, column 26: