ansible/test/integration/targets/unarchive/tasks/test_parent_not_writeable.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

32 lines
767 B
YAML

- name: check if /tmp/foo-unarchive.text exists
stat:
path: /tmp/foo-unarchive.txt
ignore_errors: True
register: unarchive04
- name: fail if the proposed destination file exists for safey
fail:
msg: /tmp/foo-unarchive.txt already exists, aborting
when: unarchive04.stat.exists
- name: try unarchiving to /tmp
unarchive:
src: '{{remote_tmp_dir}}/test-unarchive.tar.gz'
dest: /tmp
remote_src: true
register: unarchive05
- name: verify that the file was marked as changed
assert:
that:
- "unarchive05.changed == true"
- name: verify that the file was unarchived
file:
path: /tmp/foo-unarchive.txt
state: file
- name: remove our unarchive destination
file:
path: /tmp/foo-unarchive.txt
state: absent