blob: e99f0380c7a0be3011922605560138b5ed41906e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
- block:
- name: Create a group to chown to
group:
name: testgroup
- name: Create a user to chown to
user:
name: testuser
groups:
- testgroup
- name: create our tar.gz unarchive destination for chown
file:
path: "{{remote_tmp_dir}}/test-unarchive-tar-gz"
state: directory
- name: unarchive a tar.gz file with owner and group set to the above user
unarchive:
src: "{{remote_tmp_dir}}/test-unarchive.tar.gz"
dest: "{{remote_tmp_dir}}/test-unarchive-tar-gz"
remote_src: yes
owner: testuser
group: testgroup
register: unarchive02e
- name: Stat a file in the directory we unarchived to
stat:
path: "{{remote_tmp_dir}}/test-unarchive-tar-gz/foo-unarchive.txt"
register: unarchive02e_file_stat
- name: verify results
assert:
that:
- unarchive02e is changed
- unarchive02e_file_stat.stat.exists
- unarchive02e_file_stat.stat.pw_name == 'testuser'
- unarchive02e_file_stat.stat.gr_name == 'testgroup'
always:
- name: Remove testuser
user:
name: testuser
state: absent
remove: yes
force: yes
- name: Remove testgroup
group:
name: testgroup
state: absent
|