Hi all,

I'm trying to add pubkeys to several users and I'm getting an error
message.  Here's the playbook:

---
- name: Add users and pubkeys
  hosts: server1
  become: yes
  vars_files:
    - passwd.yml
    - vars.yml

  tasks:
    - name: "Add users to gong server"
      user:
        name: "{{ item.name }}"
        comment: "{{ item.comment }}"
        shell: /bin/bash
      with_items:
        - { name: "user1", comment: "user1" }
        - { name: "user2", comment: "user2" }
        - { name: "user3", comment: "user3" }
        - { name: "user4", comment: "user4" }

    - name: "Copy public keys"
      authorized_key:
        user: "{{ item.user }}"
        state: present
        key: "{{ lookup('file', 'files/pubkey/{{ item.key }}') }}"
      with_items:
        - { user: "user1", key: "user1.pub" }

Here's the error:
TASK [Copy public keys]
**********************************************************************************************************************************
failed: [server1] (item={u'user': u'user1', u'key': u'user1.pub'}) =>
{"changed": false, "item": {"key": "user1.pub", "user": "user1"}, "msg":
"invalid key specified:
TIcN+b2YbI4EzQcthGikJIkR83spy4hr0JWklq89HHMYZ1XT8rj8bwRf33hQ91oleE4YvzzZh5YKuk+QgEAvXJeXQQxvhdbZ"}

-- 
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/CAHKi8CjXHBXykAL7dwrPsXQOvb3KwF6A%2BRbdkkN%3Dmy%3DDXHF5Pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to