Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't set --output-type yaml on .yml files, but only .yaml files #164

Closed
applejag opened this issue Oct 17, 2023 · 0 comments · Fixed by #165
Closed

Doesn't set --output-type yaml on .yml files, but only .yaml files #164

applejag opened this issue Oct 17, 2023 · 0 comments · Fixed by #165

Comments

@applejag
Copy link
Contributor

SUMMARY

The automatic --output-type is only set to yaml if the file extension is .yaml. This results in .yml files getting JSON formatting.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

sops_encrypt module

ANSIBLE VERSION
ansible [core 2.15.3]
  config file = /redacted/ansible.cfg
  configured module search path = ['/home/redacted/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /redacted/.venv/lib/python3.11/site-packages/ansible
  ansible collection location = /home/redacted/.ansible/collections:/usr/share/ansible/collections
  executable location = /redacted/.venv/bin/ansible
  python version = 3.11.4 (main, Jun  6 2023, 22:16:46) [GCC 12.3.0] (/redacted/.venv/bin/python)
  jinja version = 3.1.2
  libyaml = True

COLLECTION VERSION
Collection     Version
-------------- -------
community.sops 1.6.4
CONFIGURATION
CONFIG_FILE() = /redacted/ansible.cfg
DEFAULT_FORKS(/redacted/ansible.cfg) = 200
DEFAULT_GATHERING(/redacted/ansible.cfg) = smart
DEFAULT_JINJA2_EXTENSIONS(/redacted/ansible.cfg) = jinja2.ext.do,jinja2.ext.i18n
DEFAULT_MANAGED_STR(/redacted/ansible.cfg) = "This file is Managed by Ansible - Please do not edit by hand changes will be overwritten!"
DEFAULT_ROLES_PATH(/redacted/ansible.cfg) = ['/redacted/roles.galaxy', '/redacted/roles']
DEFAULT_TIMEOUT(/redacted/ansible.cfg) = 30
DEFAULT_VAULT_IDENTITY_LIST(env: ANSIBLE_VAULT_IDENTITY_LIST) = ['/redacted/scripts/ansible-vault-keyring-client.py']
EDITOR(env: EDITOR) = nvim
HOST_KEY_CHECKING(/redacted/ansible.cfg) = False
INTERPRETER_PYTHON(/redacted/ansible.cfg) = /usr/bin/env python3
PAGER(env: PAGER) = less --raw-control-chars --quit-if-one-screen
VARIABLE_PLUGINS_ENABLED(/redacted/ansible.cfg) = ['host_group_vars', 'community.sops.sops']
OS / ENVIRONMENT

Linux 6.1.56
x86_64

STEPS TO REPRODUCE

Run the following playbook:

- hosts: localhost
  gather_facts: false
  tasks:
    - name: Create key vault file
      community.sops.sops_encrypt:
        path: "foo.yml"
        content_yaml:
          foo: bar
EXPECTED RESULTS

Content of foo.yml:

foo: ENC[AES256_GCM,data:rElC,iv:vBbFgYuKvnCrEjX2plYUvtcYmFtBpl3UBKa8xJfEv/c=,tag:oijrsyuNsykJ8J8KFVXMlQ==,type:str]
sops:
    kms: []
    gcp_kms: []
    azure_kv: []
    hc_vault: []
...snip
ACTUAL RESULTS

Content of foo.yml:

{
	"foo": "ENC[AES256_GCM,data:g0fG,iv:Bi+6De1oeqJEUnDN0zNa9me5Q0S07iOcN30eP9Z95YE=,tag:myrbR+PDl23dX0vmbP5+5A==,type:str]",
	"sops": {
		"kms": null,
		"gcp_kms": null,
		"azure_kv": null,
...snip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant