[Patchew-devel] [PATCH 5/5] deploy: allow specifying a different user to run the tester

Paolo Bonzini pbonzini at redhat.com
Tue Mar 13 17:45:45 UTC 2018


Not sure if this is particularly useful, and it has the disadvantage
of triggering an interactive session even if you're okay with the
default user "patchew".  But I'm throwing it out just in case
(for example if you want tests running as root (!)).

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 scripts/playbooks/deploy-testers.yml | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/scripts/playbooks/deploy-testers.yml b/scripts/playbooks/deploy-testers.yml
index 4303e7e..ae3ab0b 100644
--- a/scripts/playbooks/deploy-testers.yml
+++ b/scripts/playbooks/deploy-testers.yml
@@ -18,6 +18,10 @@
     - name: "tester_project"
       prompt: "Project name to test"
       private: no
+    - name: "cron_user"
+      prompt: "User that will run the tests on the host"
+      default: patchew
+      private: no
   vars:
     base_dir: "/data/{{ instance_name }}"
     src_dir: "{{ base_dir }}/src"
@@ -25,9 +29,9 @@
   tasks:
     - debug:
         msg: Patchew tester deploy starting
-    - name: "Ensure user patchew exists"
+    - name: "Ensure user {{ cron_user }} exists"
       user:
-        name: patchew
+        name: "{{ cron_user }}"
         shell: /bin/bash
         state: present
     - name: Create patchew data folder
@@ -49,23 +53,23 @@
     - name: Generate password file
       shell: "echo {{ tester_pass }} > $HOME/.patchew-tester-pass"
       become: true
-      become_user: patchew
+      become_user: "{{ cron_user }}"
     - name: Login with patchew-cli
       shell: "{{ patchew_cmd }} login {{ tester_user }} $(cat $HOME/.patchew-tester-pass)"
       become: true
-      become_user: patchew
+      become_user: "{{ cron_user }}"
     - name: Logout with patchew-cli
       shell: "{{ patchew_cmd }} logout"
       become: true
-      become_user: patchew
+      become_user: "{{ cron_user }}"
     - name: Define PATCHEW env in cron
       cron:
         name: PATCHEW
-        user: patchew
+        user: "{{ cron_user }}"
         env: yes
         value: "{{ patchew_cmd }}"
     - cron:
         name: "Patchew tester {{ instance_name }}"
-        user: patchew
+        user: "{{ cron_user }}"
         minute: "*/10"
         job: "{ $PATCHEW login {{ tester_user }} $(cat $HOME/.patchew-tester-pass); $PATCHEW tester --name {{ instance_name }} --singleton -p {{ tester_project }}; } >>$HOME/patchew-tester.log 2>&1"
-- 
2.14.3




More information about the Patchew-devel mailing list