Hello,
I’m have
[andrey@andrey ansible-test]$ ansible --version
ansible 1.9.3
configured module search path = None
This host fedora 22, the same problem occurs ansible 1.9.2 and host FreeBSD
group_vars/local contain
[andrey@andrey ansible-test]$ cat /
ssh_users:
- name: andrey
key: “{{ lookup(‘file’, ‘pub’) }}”
hosts contain
[andrey@andrey ansible-test]$ cat *
cat: group_vars: Это каталог
[local]
andrey.local
If i run simplest run with fetch, run error
$ ansible -i hosts local -m fetch -a “src=.ssh/authorized_keys dest=authorized_keys flat=yes” -vvvv
<andrey.local> ESTABLISH CONNECTION FOR USER: andrey
andrey.local | FAILED => Failed to template {{ lookup(‘file’, ‘pub’) }}: could not locate file in lookup: pub
If make blank file, fetch work fine
[andrey@andrey ansible-test]$ touch pub
[andrey@andrey ansible-test]$ ansible -i hosts local -m fetch -a “src=.ssh/authorized_keys dest=authorized_keys flat=yes” -vvvv
<andrey.local> ESTABLISH CONNECTION FOR USER: andrey
<andrey.local> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/andrey/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 andrey.local /bin/sh -c ‘rc=flag; [ -r .ssh/authorized_keys ] || rc=2; [ -f .ssh/authorized_keys ] || rc=1; [ -d .ssh/authorized_keys ] && rc=3; python -V 2>/dev/null || rc=4; [ x"$rc" != “xflag” ] && echo "${rc} “.ssh/authorized_keys && exit 0; (python -c '”’“'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1(); afile = open(”‘"’“‘.ssh/authorized_keys’”‘"’“, “rb”) buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'”‘"’ 2>/dev/null) || (python -c ‘"’“'import sha; BLOCKSIZE = 65536; hasher = sha.sha(); afile = open(”‘"’“‘.ssh/authorized_keys’”‘"’“, “rb”) buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'”‘"’ 2>/dev/null) || (echo ‘"’“'0 '”‘"’.ssh/authorized_keys)’
<andrey.local> FETCH .ssh/authorized_keys TO /home/andrey/ansible-test/authorized_keys
andrey.local | success >> {
“changed”: true,
“checksum”: “0b66c830b644def8577b5dc8127af257eeff94cc”,
“dest”: “/home/andrey/ansible-test/authorized_keys”,
“md5sum”: “692722d6be98094e0d550215de6b0a8d”,
“remote_checksum”: “0b66c830b644def8577b5dc8127af257eeff94cc”,
“remote_md5sum”: null
}
Why this can happen, the action also can not interact with this condition