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:
parent
a58bab3adf
commit
77439ae873
|
@ -9,6 +9,11 @@
|
||||||
service_path: "/lib/systemd/system/"
|
service_path: "/lib/systemd/system/"
|
||||||
when: app_env.target_os == "ubuntu"
|
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
|
- name: Install Docker Engine
|
||||||
apt:
|
apt:
|
||||||
name: docker.io
|
name: docker.io
|
||||||
|
|
|
@ -139,12 +139,23 @@
|
||||||
- kubelet
|
- kubelet
|
||||||
- kube-proxy
|
- kube-proxy
|
||||||
|
|
||||||
- name: Load cockroachdb images
|
- name: Get all container image tar files
|
||||||
command: "{{ item }}"
|
command: "{{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- "wget -q -O /opt/bin/cockroachdb.tar.gz {{ app_env.cockroachdb_repo }}"
|
- "mkdir -p /opt/bin/containerimages"
|
||||||
- "tar xf /opt/bin/cockroachdb.tar.gz -C /opt/bin"
|
- "rm -f /opt/bin/containerimages/*"
|
||||||
- "docker load --input /opt/bin/cockroachdb.tar"
|
- "wget -q -O /opt/bin/cimages.tar.gz {{ app_env.cimages_repo }}"
|
||||||
when: app_env.cockroachdb_repo != ""
|
- "tar xf /opt/bin/cimages.tar.gz -C /opt/bin/containerimages"
|
||||||
no_log: True
|
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 != ""
|
||||||
|
|
|
@ -41,7 +41,7 @@ app_env: {
|
||||||
dashboard_service_ip: "172.16.0.5",
|
dashboard_service_ip: "172.16.0.5",
|
||||||
|
|
||||||
# The following section shows an example when use a local repo.
|
# 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",
|
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/"
|
k8s_repo: "http://10.0.10.12/v1.5.4/"
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ app_env: {
|
||||||
dashboard_service_ip: "172.16.0.5",
|
dashboard_service_ip: "172.16.0.5",
|
||||||
|
|
||||||
# The following section shows an example when use a remote repo.
|
# 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",
|
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/"
|
k8s_repo: "https://storage.googleapis.com/kubernetes-release/release/v1.5.3/bin/linux/amd64/"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue