I am getting a “chown failed” error when i am running the file module to try and chown an archive file on my machine using ansible. I have no clue what this could be caused by. Help please
I have the following role:
---
- name: MyDesc
file:
path: "{{path}}"
owner: "{{owner}}"
group: "{{group}}"
mode: "{{mode}}"
force: true
state: directory
recurse: true
ignore_errors: "{{ error_ignore_flag }}"
and i am calling it as follows through ansible tower:
name: Test
hosts: "{{GLB_ansible_tower_machine}}"
remote_user: "{{GLB_remote_user}}"
become: yes
become_user: "{{GLB_remote_user}}"
become_method: sudo
roles:
- { role: file_chown, path: "/tmp/upload.ear", owner: "myUser", group: "myUser", mode: "0750", error_ignore_flag: no }
I am running this as a user who has sudo access. And /tmp/upload.ear is an archive file with the following properties:
ls -lahZ /tmp | grep upload.ear
-rw-r-----. myAnsibleTowerUser myAnsibleTowerUser unconfined_u:object_r:user_tmp_t:s0 upload.ear
When I run this however I get the following:
{
"group": "my_group",
"uid": 11111111,
"changed": false,
"failed": true,
"state": "directory",
"gid": 11111111,
"secontext": "unconfined_u:object_r:user_tmp_t:s0",
"mode": "0750",
"msg": "chown failed",
"owner": "myAnsibleTowerUser",
"path": "/tmp/upload.ear",
"size": 6,
"_ansible_no_log": false,
"play": "Test",
"task": "file_chown : MyDesc",
"role": "file_chown",
"ignore_errors": false,
"status": "failed",
"module_name": "file",
"module_args": {
"directory_mode": null,
"force": true,
"remote_src": null,
"path": "/tmp/upload.ear",
"owner": "myUser",
"follow": false,
"group": "myUser",
"state": "directory",
"content": null,
"serole": null,
"diff_peek": null,
"setype": null,
"selevel": null,
"original_basename": null,
"regexp": null,
"validate": null,
"src": null,
"seuser": null,
"recurse": true,
"delimiter": null,
"mode": "0750",
"backup": null
},
"created": "2016-05-13T15:38:12.022Z",
"host_id": 12,
"host_name": "myHost",
"id": 11111,
"parent": 11222,
"event": "Host Failed"
}