Fixing Vagrant cluster provisioning (#4218)

* Pass ansible_ssh_user as host_var

Co-authored-by: Damian Darczuk <damian.darczuk@intel.com>
Co-authored-by: Paweł Pałucki <pawel.palucki@intel.com>

* Create a directory before downloading container images to ansible host

Co-authored-by: Damian Darczuk <damian.darczuk@intel.com>
Co-authored-by: Paweł Pałucki <pawel.palucki@intel.com>

* Set private key usuing synchronize task options

Co-authored-by: Damian Darczuk <damian.darczuk@intel.com>
Co-authored-by: Paweł Pałucki <pawel.palucki@intel.com>
pull/4636/head
iwankgb 2019-04-24 14:42:05 +02:00 committed by Kubernetes Prow Robot
parent 691baf5b14
commit 4e81bcc147
2 changed files with 19 additions and 0 deletions

1
Vagrantfile vendored
View File

@ -185,6 +185,7 @@ Vagrant.configure("2") do |config|
"download_localhost": "False", "download_localhost": "False",
"local_path_provisioner_enabled": "#{$local_path_provisioner_enabled}", "local_path_provisioner_enabled": "#{$local_path_provisioner_enabled}",
"local_path_provisioner_claim_root": "#{$local_path_provisioner_claim_root}" "local_path_provisioner_claim_root": "#{$local_path_provisioner_claim_root}"
"ansible_ssh_user": SUPPORTED_OS[$os][:user]
} }
# Only execute the Ansible provisioner once, when all the machines are up and ready. # Only execute the Ansible provisioner once, when all the machines are up and ready.

View File

@ -70,12 +70,30 @@
- (ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"] or download_delegate == "localhost") - (ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"] or download_delegate == "localhost")
- (container_changed or not img.stat.exists) - (container_changed or not img.stat.exists)
- name: container_download | create container images directory on ansible host
file:
state: directory
path: "{{ fname | dirname }}"
delegate_to: localhost
delegate_facts: no
run_once: true
become: false
when:
- download.enabled
- download.container
- download_run_once
- ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"]
- inventory_hostname == download_delegate
- download_delegate != "localhost"
- saved.changed
- name: container_download | copy container images to ansible host - name: container_download | copy container images to ansible host
synchronize: synchronize:
src: "{{ fname }}" src: "{{ fname }}"
dest: "{{ fname }}" dest: "{{ fname }}"
use_ssh_args: "{{ has_bastion | default(false) }}" use_ssh_args: "{{ has_bastion | default(false) }}"
mode: pull mode: pull
private_key: "{{ ansible_ssh_private_key_file }}"
delegate_to: localhost delegate_to: localhost
delegate_facts: no delegate_facts: no
run_once: true run_once: true