Clone kubespray to location accessible by the user

When running overcloud deployment as Mistral user, we won't have
rights to alter the undercloud content (see change
I2980c584d2f4ee5c2de3720eecfc80cc43ee1fa6). If kubespray isn't found
in /usr/share/kubespray (expected RPM content location), we now clone
it elsewhere, to directory accessible by the user which runs the
overcloud deployment.

Change-Id: I9980b41668b3c838fa978e48441929d4351d101e
This commit is contained in:
Jiri Stransky
2017-11-07 17:55:01 +01:00
parent 38ab147d0b
commit 2af0769199

View File

@@ -64,13 +64,25 @@ outputs:
stat:
path: /usr/share/kubespray
register: kubespray_stat
- set_fact:
kubespray_dir: >-
{%- if kubespray_stat.stat.exists -%}
/usr/share/kubespray
{%- elif ansible_user_id == 'mistral' -%}
/var/lib/mistral/kubespray
{%- else -%}
{{ ansible_user_dir }}/kubespray
{%- endif -%}
- name: check cloned kubespray directory existence
stat:
path: "{{ kubespray_dir }}"
register: kubespray_cloned_stat
when: not kubespray_stat.stat.exists
- name: clone kubespray repo
git:
repo: https://github.com/kubernetes-incubator/kubespray
dest: /usr/share/kubespray
dest: "{{ kubespray_dir }}"
update: no
become: yes
become_user: root
when: not kubespray_stat.stat.exists
- name: kubernetes_master step 2
when: step == '2'
@@ -122,7 +134,7 @@ outputs:
copy:
dest: "{{playbook_dir}}/kubespray/playbook.yml"
content: |
- include: /usr/share/kubespray/cluster.yml
- include: {{ kubespray_dir|default('/usr/share/kubespray') }}/cluster.yml
- name: set kubespray command
set_fact:
# NOTE: We could let kubespray configure docker