Fix download dnsmasq image dependency on docker

When download_run_once with download_localhost is used, docker is
expected to be running on the delegate localhost. That may be not
the case for a non localhost delegate, which is the kube-master
otherwise. Then the dnsmasq role, had it been invoked early before
deployment starts, would fail because of the missing docker dependency.

* Fix that dependency on docker and do not pre download dnsmasq image
  for the dnsmasq role, if download_localhost is disabled.
* Remove become: false for docker CLI invocation because that's not
  the common pattern to allow users access docker CLI w/o sudo.
* Fix opt bin path hack for localhost delegate to ignore errors when
  it fails with "sudo password required" otherwise.
* Describe download_run_once with download_localhost use case in docs
  as well.

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya
2016-11-24 16:33:45 +01:00
parent f6c32c3ea3
commit aa447585c4
3 changed files with 10 additions and 4 deletions

View File

@@ -2,4 +2,4 @@
dependencies:
- role: download
file: "{{ downloads.dnsmasq }}"
when: not skip_dnsmasq|default(false)
when: not skip_dnsmasq|default(false) and download_localhost|default(false)

View File

@@ -55,6 +55,7 @@
raw: sh -c "mkdir -p /opt/bin; ln -sf /usr/bin/python /opt/bin/python"
when: "{{ download_delegate == 'localhost' }}"
delegate_to: localhost
ignore_errors: true
run_once: true
- name: Download | create local directory for saved/loaded container images
@@ -103,7 +104,6 @@
delegate_to: "{{ download_delegate }}"
register: saved
run_once: true
become: false
when: (ansible_os_family != "CoreOS" or download_delegate == "localhost") and download_run_once|bool and download.enabled|bool and download.container|bool and (container_changed|bool or not img.stat.exists)
- name: Download | copy container images to ansible host