Hi,

i have a problem with the response of the authorized_key-module in 
combination with the Jinja2 Filter "json_query". This filter works already 
fine for me with the prompt-Module where i extract all the inputs with 
"y"(query: "results[?user_input=='y']").

ansible --version
ansible 2.4.0.0
python version = 2.7.10 (default, Feb  7 2017, 00:08:15) [GCC 4.2.1 
Compatible Apple LLVM 8.0.0 (clang-800.0.34)]

This is a testplay to prey my problem(you'll need 2 testssh keys in /tmp 
with ".pub" ending, example content "ssh-rsa 123== Comment 1" ):

---
- hosts: localhost
  tasks:

    - name: test
      authorized_key:
        user: "{{ ansible_user }}"
        state: present
        path: "/tmp/test_authorized_keys"
        manage_dir: no
        key: "{{ lookup('file', item) }}"
      with_fileglob:
        - /tmp/*.pub
      register: sshKey

    - debug:
        msg: "{{ sshKey }}"

    - debug:
        msg: "{{ item.item }}"
      with_items: "{{ sshKey | json_query(query) }}"
      vars:
        query: "results[?changed==true]"
...

I expect that the second debug-module prints out the path of the changed 
key. Any ideas what i am doing wrong?

Best regards

-- 
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/5f0d9375-17db-4f69-a434-bde4403ae250%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to