S
S
Stanislav2019-04-03 15:54:12
CentOS
Stanislav, 2019-04-03 15:54:12

Why does Ansible, when copying folders that contain folders, give the latter “empty” rights?

I have a task like:

- name: Copying common web server configs
  tags:
      - services_prepare
  copy:
      src: "{{ item.src }}"
      dest: "{{ item.dest }}"
      directory_mode: yes
      owner: root
      group: root
      mode: 0644
  loop:
      - { src: "/root/repo_env/configs/common/exim/", dest: "/etc/exim/" }
      - { src: "/root/repo_env/configs/common/httpd/", dest: "/etc/httpd/" }

Its essence is that it goes through what is listed in the loop, and each time performs a copy with the parameters passed from the loop (src, dest). The folders that are specified in src there have subfolders. And these subfolders always get 0001 (d----------x) permissions when they are copied. But everything is copied as it should.
Question: Is this a glitch, or do I just need to somehow copy subfolders in a special way? I got rid of loop, that's not the point.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MurDzod, 2020-09-08
@stanislav-belichenko

I have not yet figured out why, but the record of the form

mode: 0644
does not work as described in the documentation.
The second option works: '644'

P
Puma Thailand, 2019-04-03
@opium

Why the hell do you need a loop here? how did you even come up with such a perversion and come up with it? Where did you get such brain inflammation)))
as far as I remember, ansible itself can copy directories through mines,
you just need to specify a slash at the end
without any loops

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question