ansible/test/integration/targets/unarchive/tasks/test_tar_gz_creates.yml
Philip Douglass ac5f3f8bef
unarchive - Check 'fut_gid' against 'run_gid' in addition to supplemental groups (#65666)
Add integration tests for unarchiving as unprivileged user
Break tasks into separate files for easier reading and maintenance

Create a user by specifying a default group of 'staff' for macOS.

The user module does not actually remove the user directory on macOS,
so explicitly remove it.

Put the removal tasks in an always block to ensure they always run

Co-authored-by: Philip Douglass <philip.douglass@amadeus.com>
Co-authored-by: Sam Doran <sdoran@redhat.com>
2020-07-30 15:28:05 -04:00

53 lines
1.6 KiB
YAML

- name: create our tar.gz unarchive destination for creates
file:
path: '{{remote_tmp_dir}}/test-unarchive-tar-gz'
state: directory
- name: unarchive a tar.gz file with creates set
unarchive:
src: '{{remote_tmp_dir}}/test-unarchive.tar.gz'
dest: '{{remote_tmp_dir}}/test-unarchive-tar-gz'
creates: '{{remote_tmp_dir}}/test-unarchive-tar-gz/foo-unarchive.txt'
remote_src: yes
register: unarchive02b
- name: verify that the file was marked as changed
assert:
that:
- "unarchive02b.changed == true"
- name: verify that the file was unarchived
file:
path: '{{remote_tmp_dir}}/test-unarchive-tar-gz/foo-unarchive.txt'
state: file
- name: unarchive a tar.gz file with creates over an existing file
unarchive:
src: '{{remote_tmp_dir}}/test-unarchive.tar.gz'
dest: '{{remote_tmp_dir}}/test-unarchive-tar-gz'
creates: '{{remote_tmp_dir}}/test-unarchive-tar-gz/foo-unarchive.txt'
remote_src: yes
register: unarchive02c
- name: verify that the file was not marked as changed
assert:
that:
- "unarchive02c.changed == false"
- name: unarchive a tar.gz file with creates over an existing file using complex_args
unarchive:
src: "{{remote_tmp_dir}}/test-unarchive.tar.gz"
dest: "{{remote_tmp_dir}}/test-unarchive-tar-gz"
remote_src: yes
creates: "{{remote_tmp_dir}}/test-unarchive-tar-gz/foo-unarchive.txt"
register: unarchive02d
- name: verify that the file was not marked as changed
assert:
that:
- "unarchive02d.changed == false"
- name: remove our tar.gz unarchive destination
file:
path: '{{remote_tmp_dir}}/test-unarchive-tar-gz'
state: absent