[libvirt] [libvirt-jenkins-ci PATCH 5/6] guests: Hand root password location over to Ansible

Andrea Bolognani abologna at redhat.com
Thu Oct 19 15:36:31 UTC 2017


Instead of hard-coding the location in the playbook, we hand it
over at runtime when calling ansible-playbook, ensuring better
separation of concerns.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 guests/lcitool        | 2 +-
 guests/tasks/base.yml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index 018640b..1efe7e5 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -197,7 +197,7 @@ do_prepare() {
 
     load_config
 
-    EXTRA_VARS="flavor=$FLAVOR"
+    EXTRA_VARS="flavor=$FLAVOR root_password_file=$ROOT_HASH_FILE"
 
     ansible-playbook \
         --vault-password-file "$VAULT_PASS_FILE" \
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index b220bb0..8949632 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -99,7 +99,7 @@
 - name: Configure root password and shell
   user:
     name: root
-    password: '{{ lookup("file", lookup("env", "HOME") + "/.config/lcitool/.root-password.hash") }}'
+    password: '{{ lookup("file", root_password_file) }}'
     shell: '{{ bash }}'
 
 - name: Configure ssh access for the root user
-- 
2.13.6




More information about the libvir-list mailing list