The actual folder had 777 permissions as seen below:
drwxrwxrwx 3 destuser destuser 29 Jan 14 08:40 /tmp/mohtas/folder
I took the backup using the below playbook and wanted to preserve the
permissions i.e 777 for the backup folder `
/tmp/mohtas/folder.bkp.15Jan2021_090700`
---
- name: "Play 3"
hosts: all
user: destuser
tasks:
- set_fact:
tdate: "bkp.{{ '%d%b%Y_%H%M%S' | strftime }}"
- name: Take Backup when dest_path and source path are the same.
ignore_errors: yes
copy:
src: "/tmp/mohtas/folder"
dest: "/tmp/mohtas/folder.{{ tdate }}"
mode: preserve
However, the backup folder was created with a different permissions as
below:
drwxr-xr-x 3 destuser destuser 17 Jan 15 09:07
/tmp/mohtas/folder.bkp.15Jan2021_090700
I understand that I can use stat module but was looking for a
better/quicker solution as i'm dealing with a loop of files/folders.
My ansible version is:
[destuser@desthost /]$ ansible --version ansible 2.4.2.0 config file =
/home/destuser/.ansible.cfg configured module search path =
[u'/home/destuser/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules'] ansible python module location =
/usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible
python version = 2.7.5
Note: The strange thing is the backup permissions are preserved if i
mention
src: /tmp/mohtas/file.txt as a file and not a directory.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/fa3507d0-807d-45a6-a0eb-e29dce97eca7n%40googlegroups.com.