Added command to wait for cloud-init to be done

If using ubuntu image, cloud-init has to finish before other apt
command can be performed. This patch added logic to make sure
that cloud-init get finished before proceed with other tasks.
This patch also contains changes to make the seeding docker images
more generic so that any docker image can be included in a tar.gz
file, the images in the file will be docker loaded onto each worker
node

Change-Id: I505cdb791673dc978bc21b73f7ad672172340a9d
This commit is contained in:
Tong Li 2017-04-06 13:56:20 -04:00 committed by litong01
parent a58bab3adf
commit 77439ae873
4 changed files with 24 additions and 8 deletions

View File

@ -9,6 +9,11 @@
service_path: "/lib/systemd/system/"
when: app_env.target_os == "ubuntu"
- name: Make sure that cloud-init script has completed
wait_for:
path: "/run/cloud-init/result.json"
when: app_env.target_os == "ubuntu"
- name: Install Docker Engine
apt:
name: docker.io

View File

@ -139,12 +139,23 @@
- kubelet
- kube-proxy
- name: Load cockroachdb images
- name: Get all container image tar files
command: "{{ item }}"
with_items:
- "wget -q -O /opt/bin/cockroachdb.tar.gz {{ app_env.cockroachdb_repo }}"
- "tar xf /opt/bin/cockroachdb.tar.gz -C /opt/bin"
- "docker load --input /opt/bin/cockroachdb.tar"
when: app_env.cockroachdb_repo != ""
no_log: True
- "mkdir -p /opt/bin/containerimages"
- "rm -f /opt/bin/containerimages/*"
- "wget -q -O /opt/bin/cimages.tar.gz {{ app_env.cimages_repo }}"
- "tar xf /opt/bin/cimages.tar.gz -C /opt/bin/containerimages"
when: app_env.cimages_repo != ""
- name: List all the container images tar files
find:
paths: "/opt/bin/containerimages"
patterns: "*.tar"
when: app_env.cimages_repo != ""
register: tarfiles
- name: Load container images
command: "docker load --input {{ item.path }}"
with_items: " {{ tarfiles.files }} "
when: app_env.cimages_repo != ""

View File

@ -41,7 +41,7 @@ app_env: {
dashboard_service_ip: "172.16.0.5",
# The following section shows an example when use a local repo.
cockroachdb_repo: "http://10.0.10.12/cockroachdb.tar.gz",
cimages_repo: "http://10.0.10.12/cimages.tar.gz",
flannel_repo: "http://10.0.10.12/flannel-v0.7.0-linux-amd64.tar.gz",
k8s_repo: "http://10.0.10.12/v1.5.4/"
}

View File

@ -41,7 +41,7 @@ app_env: {
dashboard_service_ip: "172.16.0.5",
# The following section shows an example when use a remote repo.
cockroachdb_repo: "",
cimages_repo: "",
flannel_repo: "https://github.com/coreos/flannel/releases/download/v0.7.0/flannel-v0.7.0-linux-amd64.tar.gz",
k8s_repo: "https://storage.googleapis.com/kubernetes-release/release/v1.5.3/bin/linux/amd64/"
}