apt_key "file" parameter doesn't seem to read from the "files" directory of a role

357 views
Skip to first unread message

Mike Titus

unread,
Apr 17, 2014, 4:52:39 PM4/17/14
to ansible...@googlegroups.com
Given this task inside main.yml within a role:

apt_key: file=percona-key-CD2EFD2A.gpg id=CD2EFD2A state=present

and given that the file percona-key-CD2EFD2A.gpg *does* exist in the /files folder for that role (with appropriate file perms), I get this error:

TASK: [haproxy | setup Percona apt-key] *************************************** 
<xx.xx.xx.xx> ESTABLISH CONNECTION FOR USER: ubuntu
<xx.xx.xx.xx> REMOTE_MODULE apt_key file=percona-key-CD2EFD2A.gpg id=CD2EFD2A state=present
<xx.xx.xx.xx> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'IdentityFile=creds/ubuntu_hap_dallas', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=ubuntu', '-o', 'ConnectTimeout=10', 'xx.xx.xx.xx', "/bin/sh -c 'mkdir -p /tmp/ansible-tmp-1397767346.58-227972599179279 && chmod a+rx /tmp/ansible-tmp-1397767346.58-227972599179279 && echo /tmp/ansible-tmp-1397767346.58-227972599179279'"]                                                                      
<xx.xx.xx.xx> PUT /tmp/tmpABaOny TO /tmp/ansible-tmp-1397767346.58-227972599179279/apt_key
<xx.xx.xx.xx> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'IdentityFile=creds/ubuntu_hap_dallas', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=ubuntu', '-o', 'ConnectTimeout=10', 'xx.xx.xx.xx', "/bin/sh -c 'chmod a+r /tmp/ansible-tmp-1397767346.58-227972599179279/apt_key'"]                                                         
<xx.xx.xx.xx> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'IdentityFile=creds/ubuntu_hap_dallas', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=ubuntu', '-o', 'ConnectTimeout=10', 'xx.xx.xx.xx', '/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=qkqxeqcwmueujkitngplsuvxhtajcnem] password: " -u root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-qkqxeqcwmueujkitngplsuvxhtajcnem; /usr/bin/python /tmp/ansible-tmp-1397767346.58-227972599179279/apt_key; rm -rf /tmp/ansible-tmp-1397767346.58-227972599179279/ >/dev/null 2>&1\'"\'"\'\'']                                   
<xx.xx.xx.xx> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'IdentityFile=creds/ubuntu_hap_dallas', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=ubuntu', '-o', 'ConnectTimeout=10', 'xx.xx.xx.xx', "/bin/sh -c 'rm -rf /tmp/ansible-tmp-1397767346.58-227972599179279/ >/dev/null 2>&1'"]                                                   
failed: [xx.xx.xx.xx] => {"cmd": "apt-key add percona-key-CD2EFD2A.gpg", "failed": true, "item": "", "rc": 2}
stderr: gpg: can't open `percona-key-CD2EFD2A.gpg': No such file or directory

msg: gpg: can't open `percona-key-CD2EFD2A.gpg': No such file or directory

Michael DeHaan

unread,
Apr 17, 2014, 6:19:17 PM4/17/14
to ansible...@googlegroups.com
"and given that the file percona-key-CD2EFD2A.gpg *does* exist in the /files folder for that role (with appropriate file perms), I get this error:"

The apt key module doesn't copy over remote files from the '/files' dir.

The file must either be local or you need to specify a URL instead.

(I agree the docs could probably be a little more clear about this, but there are very few Ansible modules that do automatic file transfer - copy and template are obvious ones, unarchive is another)







--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/cf09e33d-6530-495e-8781-d013b3979a30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages