file integration test - cleanup testing users and group

This commit is contained in:
Sam Doran 2021-06-15 15:20:31 -04:00 committed by Matt Clay
parent 5b8fb4dcd3
commit 0467b1d477
3 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,19 @@
- name: remove users
user:
name: "{{ item }}"
state: absent
remove: yes
loop:
- test1
- test_uid
- nonexistent
- "{{ remote_unprivileged_user }}"
- name: remove groups
group:
name: "{{ item }}"
state: absent
loop:
- test1
- test_gid
- nonexistent1

View file

@ -183,11 +183,13 @@
user: user:
name: test1 name: test1
uid: 1234 uid: 1234
notify: remove users
- name: create group - name: create group
group: group:
name: test1 name: test1
gid: 1234 gid: 1234
notify: remove groups
- name: change ownership and group - name: change ownership and group
file: path={{output_dir}}/baz.txt owner=1234 group=1234 file: path={{output_dir}}/baz.txt owner=1234 group=1234
@ -604,6 +606,7 @@
- name: create owner - name: create owner
user: user:
name: nonexistent name: nonexistent
notify: remove users
# I don't use state=touch here intentionally to fail and catch warnings # I don't use state=touch here intentionally to fail and catch warnings
- name: owner exist in check_mode - name: owner exist in check_mode
@ -627,6 +630,7 @@
user: user:
name: test_uid name: test_uid
uid: 111111 uid: 111111
notify: remove users
# I don't use state=touch here intentionally to fail and catch warnings # I don't use state=touch here intentionally to fail and catch warnings
- name: owner exists in check_mode, using uid - name: owner exists in check_mode, using uid
@ -650,6 +654,7 @@
- name: create group - name: create group
group: group:
name: nonexistent1 name: nonexistent1
notify: remove groups
# I don't use state=touch here intentionally to fail and catch warnings # I don't use state=touch here intentionally to fail and catch warnings
- name: group exists in check_mode - name: group exists in check_mode
@ -673,6 +678,7 @@
group: group:
name: test_gid name: test_gid
gid: 111112 gid: 111112
notify: remove groups
# I don't use state=touch here intentionally to fail and catch warnings # I don't use state=touch here intentionally to fail and catch warnings
- name: group exists in check_mode, using gid - name: group exists in check_mode, using gid

View file

@ -125,6 +125,7 @@
user: user:
name: '{{ remote_unprivileged_user }}' name: '{{ remote_unprivileged_user }}'
register: user register: user
notify: remove users
- name: Create a local temporary directory - name: Create a local temporary directory
tempfile: tempfile: