A regular user(gov1) wants to install an application (app1) owned by the
app1:app1 under the directory where app1 has permission.
The /app_mnt and its folders are all owned by app1:app1. (gov2) is part of
app1 group as well
]# ls -ld /app_mnt/app1/conf
drwxrw-r-x. 4 app1 app1 4096 Feb 26 16:41 /app_mnt/app1/conf
The regular user(gov2) uses sudo to app1 for the installation
Playbook is run as regular user (gov2) .
## main playbook
---
- hosts: all
gather_facts: False
become: True
become_method: sudo
become_user: app1
roles:
- install_app1
###install_app1
- name: create app1.yml from template
template:
src: app1.yml.j2
dest: "/app_mnt/app1/conf/app1.yml"
owner: "app1"
group: "app1"
mode: 0777
The playbook errors out as below
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
File "/tmp/ansible_copy_payload_AhBaI3/__main__.py", line 417, in main
module.set_mode_if_different(src, mode, False)
File
"/tmp/ansible_copy_payload_AhBaI3/ansible_copy_payload.zip/ansible/module_utils/basic.py",
line 1314, in set_mode_if_different
os.chmod(b_path, mode)
fatal: [fldpfs02]: FAILED! => {
"changed": false,
"checksum": "e57a94521dd0906e00b662c938b04395a48d362e",
"diff": [],
"invocation": {
"module_args": {
"_original_basename": "app1.yml.j2",
"attributes": null,
"backup": false,
"checksum": "e57a94521dd0906e00b662c938b04395a48d362e",
"content": null,
"delimiter": null,
"dest": "/app_mnt/app1/conf/app1.yml",
"directory_mode": null,
"follow": false,
"force": true,
"group": "app1",
"local_follow": null,
"mode": 511,
"owner": "app1",
"regexp": null,
"remote_src": null,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src":
"/var/tmp/ansible-tmp-1551239543.64-112658699336592/source",
"unsafe_writes": null,
}
},
"msg": "failed to copy:
/var/tmp/ansible-tmp-1551239543.64-112658699336592/source to
/app_mnt/app1/conf/app1.yml",
"traceback": "Traceback (most recent call last):\n File
\"/tmp/ansible_copy_payload_AhBaI3/__main__.py\", line 417, in main\n
module.set_mode_if_different(src, mode, False)\n File
\"/tmp/ansible_copy_payload_AhBaI3/ansible_copy_payload.zip/ansible/module_utils/basic.py\",
line 1314, in set_mode_if_different\n os.chmod(b_path, mode)\nOSError:
[Errno 1] Operation not permitted:
'/var/tmp/ansible-tmp-1551239543.64-112658699336592/source'\n"
any ideas? I don't have permission to become super-user and have to install
as app1
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/0bcb1101-92c4-4117-a3d7-1ebd6c5dd903%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.