File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 44 become : true
55 become_method : ansible.builtin.sudo
66 tasks :
7- - name : Copy /etc/resolv.conf to /tmp
7+ - name : >-
8+ Grab the current owner, group, and mode for the existing
9+ /etc/resolv.conf
10+ ansible.builtin.stat:
11+ follow: true
12+ path: /etc/resolv.conf
13+ register: resolv_conf
14+ - name : Copy /etc/resolv.conf to /tmp, preserving owner, group, and mode
815 ansible.builtin.copy :
916 dest : /tmp/resolv.conf
10- group : root
11- mode : u=rw,g=r,o=r
12- owner : root
17+ group : " {{ resolv_conf.stat.gid }} "
18+ mode : " {{ resolv_conf.stat.mode }} "
19+ owner : " {{ resolv_conf.stat.uid }} "
1320 remote_src : true
1421 src : /etc/resolv.conf
1522 - name : Unmount /etc/resolv.conf
1623 ansible.posix.mount :
1724 path : /etc/resolv.conf
1825 state : unmounted
19- - name : Copy /tmp/resolv.conf to /etc
26+ - name : Copy /tmp/resolv.conf to /etc, preserving owner, group, and mode
2027 ansible.builtin.copy :
2128 dest : /etc/resolv.conf
22- group : root
23- mode : u=rw,g=r,o=r
24- owner : root
29+ group : " {{ resolv_conf.stat.gid }} "
30+ mode : " {{ resolv_conf.stat.mode }} "
31+ owner : " {{ resolv_conf.stat.uid }} "
2532 remote_src : true
2633 src : /tmp/resolv.conf
You can’t perform that action at this time.
0 commit comments