Merge "Clone kubespray to location accessible by the user"

This commit is contained in:
Zuul 2017-11-20 14:43:04 +00:00 committed by Gerrit Code Review
commit 38d0525a5e
1 changed files with 16 additions and 4 deletions

View File

@ -64,13 +64,25 @@ outputs:
stat: stat:
path: /usr/share/kubespray path: /usr/share/kubespray
register: kubespray_stat 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 - name: clone kubespray repo
git: git:
repo: https://github.com/kubernetes-incubator/kubespray repo: https://github.com/kubernetes-incubator/kubespray
dest: /usr/share/kubespray dest: "{{ kubespray_dir }}"
update: no update: no
become: yes
become_user: root
when: not kubespray_stat.stat.exists when: not kubespray_stat.stat.exists
- name: kubernetes_master step 2 - name: kubernetes_master step 2
when: step == '2' when: step == '2'
@ -122,7 +134,7 @@ outputs:
copy: copy:
dest: "{{playbook_dir}}/kubespray/playbook.yml" dest: "{{playbook_dir}}/kubespray/playbook.yml"
content: | content: |
- include: /usr/share/kubespray/cluster.yml - include: {{ kubespray_dir|default('/usr/share/kubespray') }}/cluster.yml
- name: set kubespray command - name: set kubespray command
set_fact: set_fact:
# NOTE: We could let kubespray configure docker # NOTE: We could let kubespray configure docker