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