Control server is linux…
I’m trying to copy a file to a windows server using the template module (the file exists on windows too so I’m trying to overwrite), but I always get a permission denied error if I don’t explicitly own the file on the windows server.
- I have full control rights on the file.
- I can scp the file from the command line on our ansible control server using the same credentials without a problem. (I’ve tried both ssh keys and ansible_ssh_pass).
- I can also do an ssh and remove the file… in addition, can ssh and chown even.
- Also, the copy module works ok.
Is this a python restriction maybe?
Here is my task:
- name: “Copy template of defgen prm file to destination for env {{ playenv|default(‘all’) }}”
template: src=defgen.prm.j2 dest={{ ogg_home }}/{{ item.value.pfileloc }}/{{ item.value.pfile }}.prm backup=yes
when: >
item.value.dbsystem == playsystem
and item.value.dbenv == “{{ playenv|default(item.value.dbenv) }}”
and item.value.app | search(“{{ playapp|default(item.value.app) }}”)
and item.value.dc == “{{ playdc|default(item.value.dc) }}”
and item.key | search(“{{ defnm|default(item.key) }}”)
with_dict: defgensrc | default({})
Here is the error:
failed: [mnssstg01.surescripts.int] => (item={‘value’: {‘destsrvr’: ‘mn-lctdbs02.surescripts.int’, ‘pfile’: ‘defgen_sms2aud’, ‘app’: ‘sms’, ‘dc’: ‘MN’, ‘destdir’: ‘dirdef/oraclesm’, ‘tablistsrc’: ‘oraclesm/eosms*.prm’, ‘defsfile’: ‘mssql_sms_table.def’, ‘pfileloc’: ‘dirprm/oraclesm’, ‘dbsystem’: ‘staging’, ‘dbenv’: ‘SMS’, ‘connstr’: ‘sourcedb SMS-STAGING-MSP’, ‘outputloc’: u’L:\OGG\dirprm\oraclesm’}, ‘key’: ‘staging_sms2aud’}) => {“failed”: true, “item”: {“key”: “staging_sms2aud”, “value”: {“app”: “sms”, “connstr”: “sourcedb SMS-STAGING-MSP”, “dbenv”: “SMS”, “dbsystem”: “staging”, “dc”: “MN”, “defsfile”: “mssql_sms_table.def”, “destdir”: “dirdef/oraclesm”, “destsrvr”: “mn-lctdbs02.surescripts.int”, “outputloc”: “L:\OGG\dirprm\oraclesm”, “pfile”: “defgen_sms2aud”, “pfileloc”: “dirprm/oraclesm”, “tablistsrc”: “oraclesm/eosms*.prm”}}, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “/home/svc_dbdeploy/.ansible/tmp/ansible-tmp-1412258170.09-237634358968064/copy”, line 1438, in
main()
File “/home/svc_dbdeploy/.ansible/tmp/ansible-tmp-1412258170.09-237634358968064/copy”, line 212, in main
module.atomic_move(src, dest)
File “/home/svc_dbdeploy/.ansible/tmp/ansible-tmp-1412258170.09-237634358968064/copy”, line 1243, in atomic_move
os.chown(src, dest_stat.st_uid, dest_stat.st_gid)
OSError: [Errno 13] Permission denied: ‘/home/svc_dbdeploy/.ansible/tmp/ansible-tmp-1412258170.09-237634358968064/source’