sp-init: Detect home directory at runtime
Change-Id: I93356da3f2f83372144718c79ec6a2f8d9520cec
diff --git a/playbooks/sp-init.yaml b/playbooks/sp-init.yaml
index 736d155..c753b5d 100644
--- a/playbooks/sp-init.yaml
+++ b/playbooks/sp-init.yaml
@@ -3,6 +3,7 @@
vars:
host_id: "{{ hostvars['controller']['nodepool']['external_id'] }}"
storprep_filename: "/tmp/storprep-bootstrap-{{ host_id }}.sh"
+ homedir: "{{ ansible_env.HOME }}"
tasks:
- name: storprep
when: do_storprep is defined and do_storprep
@@ -58,21 +59,21 @@
shell:
cmd: pwd
- - name: sp-examine-ls-zuul
+ - name: sp-examine-ls-homedir
shell:
- cmd: ls -l /home/zuul
+ cmd: ls -l {{ homedir }}
- - name: sp-examine-ls-zuul-src
+ - name: sp-examine-ls-homedir-src
shell:
- cmd: ls -l /home/zuul/src
+ cmd: ls -l {{ homedir }}/src
- - name: sp-examine-ls-zuul/src/spfactory.storpool.com
+ - name: sp-examine-ls-homedir/src/spfactory.storpool.com
shell:
- cmd: ls -l /home/zuul/src/spfactory.storpool.com
+ cmd: ls -l {{ homedir }}/src/spfactory.storpool.com
- name: Apply the StorPool patches
shell:
- cmd: /home/zuul/src/spfactory.storpool.com/sp-osci/tools/bin/git-if-needed -s /home/zuul/src/spfactory.storpool.com/sp-osci/patches/series -S am
+ cmd: "{{ homedir }}/src/spfactory.storpool.com/sp-osci/tools/bin/git-if-needed -s {{ homedir }}/src/spfactory.storpool.com/sp-osci/patches/series -S am"
chdir: /opt/stack
when: sp_experimental is not defined or not sp_experimental
become: true
@@ -80,7 +81,7 @@
- name: Apply the StorPool experimental patches
shell:
- cmd: /home/zuul/src/spfactory.storpool.com/sp-osci/tools/bin/git-if-needed -s /home/zuul/src/spfactory.storpool.com/sp-osci/patches/series.experimental -S am
+ cmd: "{{ homedir }}/src/spfactory.storpool.com/sp-osci/tools/bin/git-if-needed -s {{ homedir }}/src/spfactory.storpool.com/sp-osci/patches/series.experimental -S am"
chdir: /opt/stack
when: sp_experimental is defined and sp_experimental
become: true
@@ -88,19 +89,19 @@
- name: Apply the StorPool patches to the other place
shell:
- cmd: /home/zuul/src/spfactory.storpool.com/sp-osci/tools/bin/git-if-needed -s /home/zuul/src/spfactory.storpool.com/sp-osci/patches/series am
- chdir: /home/zuul/src/opendev.org
+ cmd: "{{ homedir }}/src/spfactory.storpool.com/sp-osci/tools/bin/git-if-needed -s {{ homedir }}/src/spfactory.storpool.com/sp-osci/patches/series am"
+ chdir: "{{ homedir }}/src/opendev.org"
when: sp_experimental is not defined or not sp_experimental
- name: Apply the StorPool experimental patches to the other place
shell:
- cmd: /home/zuul/src/spfactory.storpool.com/sp-osci/tools/bin/git-if-needed -s /home/zuul/src/spfactory.storpool.com/sp-osci/patches/series.experimental am
- chdir: /home/zuul/src/opendev.org
+ cmd: "{{ homedir }}/src/spfactory.storpool.com/sp-osci/tools/bin/git-if-needed -s {{ homedir }}/src/spfactory.storpool.com/sp-osci/patches/series.experimental am"
+ chdir: "{{ homedir }}/src/opendev.org"
when: sp_experimental is defined and sp_experimental
# - name: Set up the random StorPool volume prefix
# shell:
-# cmd: /home/zuul/src/spfactory.storpool.com/sp-osci/tools/bin/sp_rand_init
+# cmd: "{{ homedir }}/src/spfactory.storpool.com/sp-osci/tools/bin/sp_rand_init"
# become: true
- hosts: all