Yes (I have secrets here, then I cut):
One file example is: inventory/dev/ssh.yml
Then the sops encrypted file has this text in clear (sops -d file):
This file is…
data:
sshpriv1: |
TEXT1
sshpub.pub: |
TEXT2
The warnings show like:
[WARNING]: Skipping key (MYKEY1) in group (data) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>
[WARNING]: Skipping key (MYKEY2) in group (data) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>
[WARNING]: Skipping key (MYKEY3 ) in group (data) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>
[WARNING]: Skipping key (MYKEY4) in group (data) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>
[WARNING]: Skipping key (kms) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleSequence’>
[WARNING]: Skipping key (gcp_kms) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleSequence’>
[WARNING]: Skipping key (azure_kv) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleSequence’>
[WARNING]: Skipping key (hc_vault) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleSequence’>
[WARNING]: Skipping key (age) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleSequence’>
[WARNING]: Skipping key (lastmodified) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>
[WARNING]: Skipping key (mac) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>
[WARNING]: Skipping key (pgp) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleSequence’>
[WARNING]: Skipping key (unencrypted_suffix) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>
[WARNING]: Skipping key (version) in group (sops) as it is not a mapping, it is a <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>
The playbook works, but show these warns.
ansible-playbook -v -i inventory/dev …
Also I’m using in Ansible configuration file:
callback_result_format=yaml
The sops version is 3.7.3.
Ah, at the moment that I write this, the inventory file is:
inventory/dev/hosts.yml
When I change the launch as:
ansible-playbook -v -i inventory/dev/hosts.yml …
The warns dissapear. Hum, howto exclude with Ansible any encrypted files to use “inventory/dev”?
Or howto reorder this structure?
You are trying to use a vars file as an inventory also, that is why
you are getting those warnings. move it into a host_vars or group_vars
directory instead