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
This commit is contained in:
Jesse Pretorius 2015-10-06 10:11:16 +01:00
parent c18c667459
commit e343d6e9fe
15 changed files with 63 additions and 15 deletions

View File

@ -24,6 +24,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Galera extra lxc config - name: Galera extra lxc config
@ -35,6 +36,7 @@
- "lxc.mount.entry=/openstack/{{ container_name }} var/lib/mysql none bind 0 0" - "lxc.mount.entry=/openstack/{{ container_name }} var/lib/mysql none bind 0 0"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_extra_config
tags: tags:
- galera-mysql-dir - galera-mysql-dir
- name: Wait for container ssh - name: Wait for container ssh
@ -44,6 +46,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_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: tags:
- galera-ssh-wait - galera-ssh-wait
vars: vars:

View File

@ -25,8 +25,10 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
wait_for: wait_for:
port: "22" port: "22"
@ -34,8 +36,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
@ -34,8 +35,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -24,6 +24,7 @@
container_config: container_config:
- "lxc.aa_profile=unconfined" - "lxc.aa_profile=unconfined"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
register: container_config
when: > when: >
not is_metal | bool and not is_metal | bool and
inventory_hostname in groups['cinder_volume'] inventory_hostname in groups['cinder_volume']
@ -67,7 +68,7 @@
tags: tags:
- cinder-container-setup - cinder-container-setup
delegate_to: "{{ physical_host }}" 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 - name: Wait for container ssh
wait_for: wait_for:
port: "22" port: "22"
@ -75,6 +76,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_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 register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check|success
retries: 3 retries: 3

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Glance extra lxc config - name: Glance extra lxc config
@ -36,6 +37,7 @@
- "lxc.mount.entry=/openstack/{{ container_name }} var/lib/glance/images none bind 0 0" - "lxc.mount.entry=/openstack/{{ container_name }} var/lib/glance/images none bind 0 0"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_extra_config
tags: tags:
- glance-cache-dir - glance-cache-dir
- name: Wait for container ssh - name: Wait for container ssh
@ -45,8 +47,11 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_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 register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
@ -34,8 +35,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
@ -34,8 +35,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
@ -34,8 +35,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -27,6 +27,7 @@
when: > when: >
not is_metal | bool and not is_metal | bool and
inventory_hostname in groups['neutron_agent'] inventory_hostname in groups['neutron_agent']
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Neutron extra lxc config - name: Neutron extra lxc config
@ -41,6 +42,7 @@
when: > when: >
not is_metal | bool and not is_metal | bool and
inventory_hostname in groups['neutron_agent'] inventory_hostname in groups['neutron_agent']
register: container_extra_config
tags: tags:
- neutron-container-setup - neutron-container-setup
- name: Wait for container ssh - name: Wait for container ssh
@ -50,8 +52,11 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_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 register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
@ -34,8 +35,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -27,6 +27,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
@ -36,8 +37,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
@ -34,8 +35,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Package repo extra lxc config - name: Package repo extra lxc config
@ -36,6 +37,7 @@
- "lxc.mount.entry=/openstack/{{ container_name }} var/www none bind 0 0" - "lxc.mount.entry=/openstack/{{ container_name }} var/www none bind 0 0"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_extra_config
tags: tags:
- repo-dirs - repo-dirs
- name: Wait for container ssh - name: Wait for container ssh
@ -45,8 +47,11 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_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 register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,9 +25,10 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Ensure log stroage directory exists - name: Ensure log storage directory exists
file: file:
path: "/openstack/{{ container_name }}/log-storage" path: "/openstack/{{ container_name }}/log-storage"
state: "directory" state: "directory"
@ -44,6 +45,7 @@
- "lxc.mount.entry=/openstack/{{ container_name }}/log-storage {{ storage_directory.lstrip('/') }} none bind 0 0" - "lxc.mount.entry=/openstack/{{ container_name }}/log-storage {{ storage_directory.lstrip('/') }} none bind 0 0"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_extra_config
tags: tags:
- rsyslog-storage-dirs - rsyslog-storage-dirs
- name: Wait for container ssh - name: Wait for container ssh
@ -53,8 +55,11 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_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 register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait

View File

@ -25,6 +25,7 @@
- "lxc.aa_profile=lxc-openstack" - "lxc.aa_profile=lxc-openstack"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: not is_metal | bool when: not is_metal | bool
register: container_config
tags: tags:
- lxc-aa-profile - lxc-aa-profile
- name: Wait for container ssh - name: Wait for container ssh
@ -34,8 +35,9 @@
search_regex: "OpenSSH" search_regex: "OpenSSH"
host: "{{ ansible_ssh_host }}" host: "{{ ansible_ssh_host }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
when: container_config is defined and container_config | changed
register: ssh_wait_check register: ssh_wait_check
until: ssh_wait_check|success until: ssh_wait_check | success
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait