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"
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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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