From 5bb759e7ab0e8d339ba106a7e75e8cc3d88cea2a Mon Sep 17 00:00:00 2001 From: Will Thames Date: Wed, 11 Nov 2015 23:42:35 +1000 Subject: [PATCH] Elevate privileges when checking for file existence Certain OSs default to home directories as 0700 Without elevating privileges, checking for file existence fails. --- test/integration/roles/test_become/tasks/main.yml | 6 ++++++ test/integration/roles/test_sudo/tasks/main.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/test/integration/roles/test_become/tasks/main.yml b/test/integration/roles/test_become/tasks/main.yml index 1b00759645..86462d4eea 100644 --- a/test/integration/roles/test_become/tasks/main.yml +++ b/test/integration/roles/test_become/tasks/main.yml @@ -24,6 +24,8 @@ state: touch - name: check that the path in the user's home dir was created + become: True + become_user: "{{ become_test_user }}" stat: path: "~{{ become_test_user }}/foo.txt" register: results @@ -41,6 +43,8 @@ dest: "~/bar.txt" - name: check that the path in the user's home dir was created + become: True + become_user: "{{ become_test_user }}" stat: path: "~{{ become_test_user }}/bar.txt" register: results @@ -58,6 +62,8 @@ dest: "~/baz.txt" - name: check that the path in the user's home dir was created + become: True + become_user: "{{ become_test_user }}" stat: path: "~{{ become_test_user }}/baz.txt" register: results diff --git a/test/integration/roles/test_sudo/tasks/main.yml b/test/integration/roles/test_sudo/tasks/main.yml index 372f175d29..f77c218d5e 100644 --- a/test/integration/roles/test_sudo/tasks/main.yml +++ b/test/integration/roles/test_sudo/tasks/main.yml @@ -23,6 +23,8 @@ state: touch - name: check that the path in the user's home dir was created + sudo: True + sudo_user: "{{ sudo_test_user }}" stat: path: "~{{ sudo_test_user }}/foo.txt" register: results @@ -40,6 +42,8 @@ dest: "~/bar.txt" - name: check that the path in the user's home dir was created + sudo: True + sudo_user: "{{ sudo_test_user }}" stat: path: "~{{ sudo_test_user }}/bar.txt" register: results @@ -57,6 +61,8 @@ dest: "~/baz.txt" - name: check that the path in the user's home dir was created + sudo: True + sudo_user: "{{ sudo_test_user }}" stat: path: "~{{ sudo_test_user }}/baz.txt" register: results