On 12.10.2017 11:42, Goetz Leupold wrote:
There is no output of the second debug-task. Dont know why...
Output of the command:
<snip />
TASK [debug]
********************************************************************************************************
ok: [localhost] => {}
MSG:
{'msg': u'All items completed', 'changed': True, 'results':
[{u'comment':
None, u'exclusive': False, u'uid': 218476800, u'owner':
u'blackended_user',
u'manage_dir': False, u'group': u'ADS\\Dom\xe4nen-Benutzer', 'failed':
False, u'state': u'file', u'gid': 31346032, u'invocation':
{u'module_args':
{u'comment': None, u'exclusive': False, u'validate_certs': True,
u'key_options': None, u'state': u'present', u'user':
u'blackended_user',
u'key': u'ssh-rsa 123== Comment 1', u'path':
u'/tmp/test_authorized_keys',
u'unique': False, u'keyfile': u'/tmp/test_authorized_keys',
u'manage_dir':
False}}, u'size': 24, '_ansible_parsed': True, '_ansible_item_result':
True, u'key_options': None, u'user': u'blackended_user', u'key':
u'ssh-rsa
123== Comment 1', u'path': u'/tmp/test_authorized_keys', u'unique':
False,
'_ansible_no_log': False, u'keyfile': u'/tmp/test_authorized_keys',
'changed': False, 'item': u'/tmp/1.pub', u'mode': u'0600',
u'validate_certs': True}, {u'comment': None, u'exclusive': False,
u'uid':
218476800, u'owner': u'blackended_user', u'manage_dir': False,
u'group':
u'ADS\\Dom\xe4nen-Benutzer', 'failed': False, u'state': u'file',
u'gid':
31346032, u'invocation': {u'module_args': {u'comment': None,
u'exclusive':
False, u'validate_certs': True, u'changed': True, u'key_options': None,
u'state': u'present', u'user': u'blackended_user', u'key': u'ssh-rsa
456==
Comment 2', u'path': u'/tmp/test_authorized_keys', u'unique': False,
u'keyfile': u'/tmp/test_authorized_keys', u'manage_dir': False}},
u'size':
48, '_ansible_parsed': True, '_ansible_item_result': True,
u'key_options':
None, u'user': u'blackended_user', u'key': u'ssh-rsa 456== Comment 2',
u'path': u'/tmp/test_authorized_keys', u'unique': False,
'_ansible_no_log':
False, u'keyfile': u'/tmp/test_authorized_keys', u'changed': True,
'item':
u'/tmp/2.pub', u'mode': u'0600', u'validate_certs': True}]}
Instead of
- debug:
msg: "{{ item.item }}"
with_items: "{{ sshKey | json_query(query) }}"
vars:
query: "results[?changed==true]"
You can use this
- debug:
msg: "{{ item.item }}"
with_items: '{{ sshKey.results }}'
when: item.changed
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/496bd99b9945156c74b985f275c229ea%40olstad.com.
For more options, visit https://groups.google.com/d/optout.