1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #13127 from willthames/test_become

Elevate privileges when checking for file existence
This commit is contained in:
Brian Coca 2015-11-12 22:35:01 -08:00
commit 5d645f3a8b
2 changed files with 12 additions and 0 deletions

View file

@ -24,6 +24,8 @@
state: touch state: touch
- name: check that the path in the user's home dir was created - name: check that the path in the user's home dir was created
become: True
become_user: "{{ become_test_user }}"
stat: stat:
path: "~{{ become_test_user }}/foo.txt" path: "~{{ become_test_user }}/foo.txt"
register: results register: results
@ -41,6 +43,8 @@
dest: "~/bar.txt" dest: "~/bar.txt"
- name: check that the path in the user's home dir was created - name: check that the path in the user's home dir was created
become: True
become_user: "{{ become_test_user }}"
stat: stat:
path: "~{{ become_test_user }}/bar.txt" path: "~{{ become_test_user }}/bar.txt"
register: results register: results
@ -58,6 +62,8 @@
dest: "~/baz.txt" dest: "~/baz.txt"
- name: check that the path in the user's home dir was created - name: check that the path in the user's home dir was created
become: True
become_user: "{{ become_test_user }}"
stat: stat:
path: "~{{ become_test_user }}/baz.txt" path: "~{{ become_test_user }}/baz.txt"
register: results register: results

View file

@ -23,6 +23,8 @@
state: touch state: touch
- name: check that the path in the user's home dir was created - name: check that the path in the user's home dir was created
sudo: True
sudo_user: "{{ sudo_test_user }}"
stat: stat:
path: "~{{ sudo_test_user }}/foo.txt" path: "~{{ sudo_test_user }}/foo.txt"
register: results register: results
@ -40,6 +42,8 @@
dest: "~/bar.txt" dest: "~/bar.txt"
- name: check that the path in the user's home dir was created - name: check that the path in the user's home dir was created
sudo: True
sudo_user: "{{ sudo_test_user }}"
stat: stat:
path: "~{{ sudo_test_user }}/bar.txt" path: "~{{ sudo_test_user }}/bar.txt"
register: results register: results
@ -57,6 +61,8 @@
dest: "~/baz.txt" dest: "~/baz.txt"
- name: check that the path in the user's home dir was created - name: check that the path in the user's home dir was created
sudo: True
sudo_user: "{{ sudo_test_user }}"
stat: stat:
path: "~{{ sudo_test_user }}/baz.txt" path: "~{{ sudo_test_user }}/baz.txt"
register: results register: results