diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/become/tasks/become.yml | |
parent | Initial commit. (diff) | |
download | ansible-core-upstream/2.14.3.tar.xz ansible-core-upstream/2.14.3.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | test/integration/targets/become/tasks/become.yml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/integration/targets/become/tasks/become.yml b/test/integration/targets/become/tasks/become.yml new file mode 100644 index 0000000..d31634f --- /dev/null +++ b/test/integration/targets/become/tasks/become.yml @@ -0,0 +1,49 @@ +- name: test becoming user ({{ become_test }}) + raw: whoami + register: whoami + +- name: implicit tilde expansion reflects become user ({{ become_test }}) + stat: + path: "~" + register: stat_home_implicit + +- name: explicit tilde expansion reflects become user ({{ become_test }}) + stat: + path: "~{{ ansible_become_user }}" + register: stat_home_explicit + +- name: put a file ({{ become_test }}) + copy: + src: copy.txt + dest: "~{{ ansible_become_user }}/{{ ansible_become_method }}-{{ ansible_become_user }}-copy.txt" + register: put_file + +- name: fetch a file ({{ become_test }}) + fetch: + src: "~{{ ansible_become_user }}/{{ ansible_become_method }}-{{ ansible_become_user }}-copy.txt" + dest: "{{ output_dir }}" + register: fetch_file + +- name: explicit tilde expansion reflects become user ({{ become_test }}) + stat: + path: "~{{ ansible_become_user }}/{{ ansible_become_method }}-{{ ansible_become_user }}-copy.txt" + register: stat_file + +- name: verify results from previous tasks ({{ become_test }}) + assert: + that: + - "whoami.stdout|trim == ansible_become_user" + + - "stat_home_implicit.stat.exists == True" + - "stat_home_implicit.stat.path|basename == ansible_become_user" + + - "stat_home_explicit.stat.exists == True" + - "stat_home_explicit.stat.path|basename == ansible_become_user" + + - "put_file.uid == test_user.uid" + - "put_file.gid == test_user.group" + + - "fetch_file.remote_checksum == put_file.checksum" + + - "stat_file.stat.exists == True" + - "stat_file.stat.path|dirname|basename == ansible_become_user" |