[CORD-1608]
Fix DNS and ansible timeout issues when building docker images
Change-Id: I549387d458c280ac769e9c3a06a5e035457c0815
diff --git a/Makefile b/Makefile
index 24a3d76..c408ccd 100644
--- a/Makefile
+++ b/Makefile
@@ -99,6 +99,12 @@
xos-update-images: clean-images
rm -f $(M)/start-xos $(M)/local-start-xos
+ansible-ping:
+ $(ANSIBLE) -m ping all $(LOGCMD)
+
+ansible-setup:
+ $(ANSIBLE) -m setup all $(LOGCMD)
+
collect-diag:
$(ANSIBLE_PB) $(PI)/collect-diag-playbook.yml $(LOGCMD)
@@ -134,6 +140,7 @@
COPY_CONFIG_PREREQS ?=
PREP_BUILDNODE_PREREQS ?=
PREP_HEADNODE_PREREQS ?=
+DOCKER_IMAGES_PREREQS ?=
START_XOS_PREREQS ?=
DEPLOY_ONOS_PREREQS ?=
@@ -165,8 +172,8 @@
$(M)/prep-buildnode: | $(M)/vagrant-up $(M)/cord-config $(PREP_BUILDNODE_PREREQS)
$(ANSIBLE_PB) $(PI)/prep-buildnode-playbook.yml $(LOGCMD)
- @echo Waiting 10 seconds to timeout SSH ControlPersist, and so future ansible commands gain docker group membership
- sleep 10
+ @echo Waiting 20 seconds to timeout SSH ControlPersist, and so future ansible commands gain docker group membership
+ sleep 20
touch $@
$(M)/prep-headnode: | $(M)/vagrant-up $(M)/cord-config $(PREP_HEADNODE_PREREQS)
@@ -197,7 +204,7 @@
$(ANSIBLE_PB) $(PI)/deploy-computenode-playbook.yml $(LOGCMD)
touch $@
-$(M)/docker-images: | $(M)/prep-buildnode
+$(M)/docker-images: | $(M)/prep-buildnode $(DOCKER_IMAGES_PREREQS)
$(SSH_BUILD) "cd /opt/cord/build; $(IMAGEBUILDER) -f $(MASTER_CONFIG) -l $(BUILD)/image_logs -g $(BUILD)/ib_graph.dot -a $(BUILD)/ib_actions.yml " $(LOGCMD)
touch $@
@@ -209,10 +216,6 @@
$(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/start-xos-playbook.yml" $(LOGCMD)
touch $@
-$(M)/onboard-profile: | $(M)/start-xos
- $(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/onboard-profile-playbook.yml" $(LOGCMD)
- touch $@
-
$(M)/build-onos-apps: | $(M)/prep-buildnode
$(SSH_BUILD) "cd /opt/cord/onos-apps; make images" $(LOGCMD)
touch $@
@@ -222,6 +225,14 @@
$(ANSIBLE_PB) $(PI)/deploy-onos-playbook.yml $(LOGCMD)
touch $@
+$(M)/onboard-profile: | $(M)/start-xos $(M)/deploy-onos
+ $(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/onboard-profile-playbook.yml" $(LOGCMD)
+ touch $@
+
+$(M)/onos-debug: | $(M)/onboard-profile
+ $(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/onos-debug-playbook.yml" $(LOGCMD)
+ touch $@
+
$(M)/onboard-openstack: | $(M)/deploy-computenode $(M)/glance-images $(M)/deploy-onos $(M)/onboard-profile
$(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/onboard-openstack-playbook.yml" $(LOGCMD)
touch $@
diff --git a/ansible.cfg b/ansible.cfg
index 1b10379..073b1f5 100644
--- a/ansible.cfg
+++ b/ansible.cfg
@@ -5,5 +5,5 @@
timeout=30
[ssh_connection]
-ssh_args = -o ControlMaster=auto -o ControlPersist=3s
+ssh_args = -o ControlMaster=auto -o ControlPersist=15s
diff --git a/ansible/roles/genconfig/templates/config.mk.j2 b/ansible/roles/genconfig/templates/config.mk.j2
index b778176..fa6bcbf 100644
--- a/ansible/roles/genconfig/templates/config.mk.j2
+++ b/ansible/roles/genconfig/templates/config.mk.j2
@@ -38,6 +38,9 @@
{% if prep_headnode_prereqs is defined %}
PREP_HEADNODE_PREREQS = $(M)/{{ prep_headnode_prereqs | join(" $(M)/") }}
{% endif %}
+{% if docker_images_prereqs is defined %}
+DOCKER_IMAGES_PREREQS = $(M)/{{ docker_images_prereqs | join(" $(M)/") }}
+{% endif %}
{% if start_xos_prereqs is defined %}
START_XOS_PREREQS = $(M)/{{ start_xos_prereqs | join(" $(M)/") }}
{% endif %}
diff --git a/ansible/roles/genconfig/templates/inventory.ini.j2 b/ansible/roles/genconfig/templates/inventory.ini.j2
index f23f475..74cf4ac 100644
--- a/ansible/roles/genconfig/templates/inventory.ini.j2
+++ b/ansible/roles/genconfig/templates/inventory.ini.j2
@@ -6,6 +6,7 @@
{% if inventory_groups[groupname] %}
{% for g_key, g_val in inventory_groups[groupname].iteritems() %}
{{ g_key }}{% if g_val %} {% for key, val in g_val.iteritems() %}{{ key ~ "=" ~ val }}{% endfor %}{% endif %}
+
{% endfor %}
{% endif %}
{% endmacro %}
diff --git a/scenarios/cord/config.yml b/scenarios/cord/config.yml
index 729b96b..7b075ee 100644
--- a/scenarios/cord/config.yml
+++ b/scenarios/cord/config.yml
@@ -37,6 +37,10 @@
- copy-cord
- copy-config
+# Wait until headnode prepped before building containers, for consistent DNS
+docker_images_prereqs:
+ - prep-headnode
+
# Start elasticstack before XOS/ONOS, which log to it
start_xos_prereqs:
- deploy-elasticstack
diff --git a/scenarios/mock/config.yml b/scenarios/mock/config.yml
index 2b90aa5..9885554 100644
--- a/scenarios/mock/config.yml
+++ b/scenarios/mock/config.yml
@@ -32,11 +32,15 @@
prep_headnode_prereqs:
- prep-buildnode
+docker_images_prereqs:
+ - prep-headnode
+
# mock profile configuration
frontend_only: True
use_maas: False
use_apt_cache: False
use_openstack: False
+create_configdirs_become: False
xos_images: []
# whitelist of images for imagebuilder to build/pull (tagged elsewhere)
diff --git a/scenarios/opencloud/config.yml b/scenarios/opencloud/config.yml
index f705289..e9a6a79 100644
--- a/scenarios/opencloud/config.yml
+++ b/scenarios/opencloud/config.yml
@@ -16,6 +16,7 @@
# Make build config
build_targets:
+ - onos-debug
- onboard-openstack
vagrant_up_prereqs:
@@ -36,6 +37,10 @@
prep_headnode_prereqs:
- prep-buildnode
+# Wait until headnode prepped before building containers, for consistent DNS
+docker_images_prereqs:
+ - prep-headnode
+
# Start elasticstack before XOS/ONOS, which log to it
start_xos_prereqs:
- deploy-elasticstack
@@ -50,14 +55,15 @@
aliases:
- head
- name: compute1
- ipv4_last_octet: 20
+ ipv4_last_octet: 250
- name: compute2
- ipv4_last_octet: 21
+ ipv4_last_octet: 251
# Vagrant VM configuration
vagrant_vms:
- head1
- compute1
+ - compute2
head_vm_mem: 16384
head_vm_cpu: 8
@@ -114,4 +120,5 @@
compute:
compute1:
+ compute2:
diff --git a/scenarios/single/config.yml b/scenarios/single/config.yml
index 4ceb2cb..11ed821 100644
--- a/scenarios/single/config.yml
+++ b/scenarios/single/config.yml
@@ -32,11 +32,15 @@
prep_headnode_prereqs:
- prep-buildnode
+docker_images_prereqs:
+ - prep-headnode
+
# single scenario configuration
frontend_only: False
use_maas: False
use_apt_cache: False
use_openstack: False
+create_configdirs_become: False
xos_images: []
# whitelist of images for imagebuilder to build/pull (tagged elsewhere)