From 4e81bcc14716f4453203b577dec3c42d35bcbc39 Mon Sep 17 00:00:00 2001 From: iwankgb Date: Wed, 24 Apr 2019 14:42:05 +0200 Subject: [PATCH] Fixing Vagrant cluster provisioning (#4218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Pass ansible_ssh_user as host_var Co-authored-by: Damian Darczuk Co-authored-by: Paweł Pałucki * Create a directory before downloading container images to ansible host Co-authored-by: Damian Darczuk Co-authored-by: Paweł Pałucki * Set private key usuing synchronize task options Co-authored-by: Damian Darczuk Co-authored-by: Paweł Pałucki --- Vagrantfile | 1 + roles/download/tasks/sync_container.yml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 2d41f34bf..881fafcf1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -185,6 +185,7 @@ Vagrant.configure("2") do |config| "download_localhost": "False", "local_path_provisioner_enabled": "#{$local_path_provisioner_enabled}", "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. diff --git a/roles/download/tasks/sync_container.yml b/roles/download/tasks/sync_container.yml index 2801a6f5d..4af3bdcb6 100644 --- a/roles/download/tasks/sync_container.yml +++ b/roles/download/tasks/sync_container.yml @@ -70,12 +70,30 @@ - (ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"] or download_delegate == "localhost") - (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 synchronize: src: "{{ fname }}" dest: "{{ fname }}" use_ssh_args: "{{ has_bastion | default(false) }}" mode: pull + private_key: "{{ ansible_ssh_private_key_file }}" delegate_to: localhost delegate_facts: no run_once: true