From e343d6e9fe15f9f3ae4ee1502fbf2a280af19209 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 6 Oct 2015 10:11:16 +0100 Subject: [PATCH] Only wait for SSH if the container config has changed This patch reduces the time it takes for the playbooks to execute when the container configuration has not changed as the task to wait for a successful ssh connection (after an initial delay) is not executed. Change-Id: I52727d6422878c288884a70c466ccc98cd6fd0ff --- playbooks/galera-install.yml | 5 +++++ playbooks/memcached-install.yml | 5 ++++- playbooks/os-ceilometer-install.yml | 4 +++- playbooks/os-cinder-install.yml | 6 +++++- playbooks/os-glance-install.yml | 7 ++++++- playbooks/os-heat-install.yml | 4 +++- playbooks/os-horizon-install.yml | 4 +++- playbooks/os-keystone-install.yml | 4 +++- playbooks/os-neutron-install.yml | 7 ++++++- playbooks/os-nova-install.yml | 4 +++- playbooks/os-swift-setup.yml | 4 +++- playbooks/rabbitmq-install.yml | 4 +++- playbooks/repo-server.yml | 7 ++++++- playbooks/rsyslog-install.yml | 9 +++++++-- playbooks/utility-install.yml | 4 +++- 15 files changed, 63 insertions(+), 15 deletions(-) diff --git a/playbooks/galera-install.yml b/playbooks/galera-install.yml index ecf6db1666..315f201976 100644 --- a/playbooks/galera-install.yml +++ b/playbooks/galera-install.yml @@ -24,6 +24,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Galera extra lxc config @@ -35,6 +36,7 @@ - "lxc.mount.entry=/openstack/{{ container_name }} var/lib/mysql none bind 0 0" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_extra_config tags: - galera-mysql-dir - name: Wait for container ssh @@ -44,6 +46,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: > + (container_config is defined and container_config | changed) or + (container_extra_config is defined and container_extra_config | changed) tags: - galera-ssh-wait vars: diff --git a/playbooks/memcached-install.yml b/playbooks/memcached-install.yml index f8a8d72cb3..5355665320 100644 --- a/playbooks/memcached-install.yml +++ b/playbooks/memcached-install.yml @@ -25,8 +25,10 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile + - name: Wait for container ssh wait_for: port: "22" @@ -34,8 +36,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/os-ceilometer-install.yml b/playbooks/os-ceilometer-install.yml index ae213920c0..a9bb7e5e01 100644 --- a/playbooks/os-ceilometer-install.yml +++ b/playbooks/os-ceilometer-install.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Wait for container ssh @@ -34,8 +35,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/os-cinder-install.yml b/playbooks/os-cinder-install.yml index 6d2be3c6fb..2998a92992 100644 --- a/playbooks/os-cinder-install.yml +++ b/playbooks/os-cinder-install.yml @@ -24,6 +24,7 @@ container_config: - "lxc.aa_profile=unconfined" delegate_to: "{{ physical_host }}" + register: container_config when: > not is_metal | bool and inventory_hostname in groups['cinder_volume'] @@ -67,7 +68,7 @@ tags: - cinder-container-setup delegate_to: "{{ physical_host }}" - when: lxc_config is defined and lxc_config.changed + when: lxc_config is defined and lxc_config | changed - name: Wait for container ssh wait_for: port: "22" @@ -75,6 +76,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: > + (container_config is defined and container_config | changed) or + (lxc_config is defined and lxc_config | changed) register: ssh_wait_check until: ssh_wait_check|success retries: 3 diff --git a/playbooks/os-glance-install.yml b/playbooks/os-glance-install.yml index b6f5aa5701..461ba484b1 100644 --- a/playbooks/os-glance-install.yml +++ b/playbooks/os-glance-install.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Glance extra lxc config @@ -36,6 +37,7 @@ - "lxc.mount.entry=/openstack/{{ container_name }} var/lib/glance/images none bind 0 0" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_extra_config tags: - glance-cache-dir - name: Wait for container ssh @@ -45,8 +47,11 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: > + (container_config is defined and container_config | changed) or + (container_extra_config is defined and container_config | changed) register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/os-heat-install.yml b/playbooks/os-heat-install.yml index 8952bcfc85..f9f41f7bb5 100644 --- a/playbooks/os-heat-install.yml +++ b/playbooks/os-heat-install.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Wait for container ssh @@ -34,8 +35,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/os-horizon-install.yml b/playbooks/os-horizon-install.yml index 07e25292ec..4ede07b00d 100644 --- a/playbooks/os-horizon-install.yml +++ b/playbooks/os-horizon-install.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Wait for container ssh @@ -34,8 +35,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/os-keystone-install.yml b/playbooks/os-keystone-install.yml index cab9327201..5b6068eba8 100644 --- a/playbooks/os-keystone-install.yml +++ b/playbooks/os-keystone-install.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Wait for container ssh @@ -34,8 +35,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/os-neutron-install.yml b/playbooks/os-neutron-install.yml index 428110bae8..f901c14d1e 100644 --- a/playbooks/os-neutron-install.yml +++ b/playbooks/os-neutron-install.yml @@ -27,6 +27,7 @@ when: > not is_metal | bool and inventory_hostname in groups['neutron_agent'] + register: container_config tags: - lxc-aa-profile - name: Neutron extra lxc config @@ -41,6 +42,7 @@ when: > not is_metal | bool and inventory_hostname in groups['neutron_agent'] + register: container_extra_config tags: - neutron-container-setup - name: Wait for container ssh @@ -50,8 +52,11 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: > + (container_config is defined and container_config | changed) or + (container_extra_config is defined and container_extra_config | changed) register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/os-nova-install.yml b/playbooks/os-nova-install.yml index 572599fb0b..d4186d967e 100644 --- a/playbooks/os-nova-install.yml +++ b/playbooks/os-nova-install.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Wait for container ssh @@ -34,8 +35,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/os-swift-setup.yml b/playbooks/os-swift-setup.yml index f4bd554a1e..be63f18d8f 100644 --- a/playbooks/os-swift-setup.yml +++ b/playbooks/os-swift-setup.yml @@ -27,6 +27,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Wait for container ssh @@ -36,8 +37,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/rabbitmq-install.yml b/playbooks/rabbitmq-install.yml index 12a4d72ed2..668cd0f376 100644 --- a/playbooks/rabbitmq-install.yml +++ b/playbooks/rabbitmq-install.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Wait for container ssh @@ -34,8 +35,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/repo-server.yml b/playbooks/repo-server.yml index 05016d226c..721f875e05 100644 --- a/playbooks/repo-server.yml +++ b/playbooks/repo-server.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Package repo extra lxc config @@ -36,6 +37,7 @@ - "lxc.mount.entry=/openstack/{{ container_name }} var/www none bind 0 0" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_extra_config tags: - repo-dirs - name: Wait for container ssh @@ -45,8 +47,11 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: > + (container_config is defined and container_config | changed) or + (container_extra_config is defined and container_extra_config | changed) register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/rsyslog-install.yml b/playbooks/rsyslog-install.yml index ae5d1f7d19..adc0b27f62 100644 --- a/playbooks/rsyslog-install.yml +++ b/playbooks/rsyslog-install.yml @@ -25,9 +25,10 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - - name: Ensure log stroage directory exists + - name: Ensure log storage directory exists file: path: "/openstack/{{ container_name }}/log-storage" state: "directory" @@ -44,6 +45,7 @@ - "lxc.mount.entry=/openstack/{{ container_name }}/log-storage {{ storage_directory.lstrip('/') }} none bind 0 0" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_extra_config tags: - rsyslog-storage-dirs - name: Wait for container ssh @@ -53,8 +55,11 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: > + (container_config is defined and container_config | changed) or + (container_extra_config is defined and container_extra_config | changed) register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait diff --git a/playbooks/utility-install.yml b/playbooks/utility-install.yml index 45240d55b1..3047eaf5dc 100644 --- a/playbooks/utility-install.yml +++ b/playbooks/utility-install.yml @@ -25,6 +25,7 @@ - "lxc.aa_profile=lxc-openstack" delegate_to: "{{ physical_host }}" when: not is_metal | bool + register: container_config tags: - lxc-aa-profile - name: Wait for container ssh @@ -34,8 +35,9 @@ search_regex: "OpenSSH" host: "{{ ansible_ssh_host }}" delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed register: ssh_wait_check - until: ssh_wait_check|success + until: ssh_wait_check | success retries: 3 tags: - ssh-wait