From 4cbb0d8b98255bcaab71ff04676cbcb73b0c0ddb Mon Sep 17 00:00:00 2001 From: Shannon Mitchell Date: Fri, 2 Mar 2018 09:54:34 -0600 Subject: [PATCH] Fix Ssh connection issues on openstack-ansible-ops mnaio builds We normally see ssh connection issues during the lxc container setup portion of OSA builds. Most people usually end up tweaking ansible ssh pipeline and retry settings or nerfing the build via ansible fork lowering to work around it. This is an old issue that we normally put a more permanent fix in our physical environments by setting the ssh maxsessions and maxstartups. On the mnaio builds I have been working around this by stopping the build before deployment and making the changes in a script. Change-Id: I54c223e1fb9edf6947bc7f76ff689bad22456420 Closes-Bug: 1752914 --- multi-node-aio/playbooks/deploy-vms.yml | 43 ++++++++++++++++++++++++ multi-node-aio/playbooks/vars/ubuntu.yml | 3 ++ 2 files changed, 46 insertions(+) diff --git a/multi-node-aio/playbooks/deploy-vms.yml b/multi-node-aio/playbooks/deploy-vms.yml index 08b6685e..c733167f 100644 --- a/multi-node-aio/playbooks/deploy-vms.yml +++ b/multi-node-aio/playbooks/deploy-vms.yml @@ -177,6 +177,47 @@ - deploy-vms +- name: Set MaxSessions and MaxStartups to reduce connection failures + hosts: vm_servers + gather_facts: "{{ gather_facts | default(true) }}" + pre_tasks: + - name: Gather variables for each operating system + include_vars: "{{ item }}" + with_first_found: + - "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml" + - "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml" + - "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" + - "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}.yml" + - "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}.yml" + tags: + - always + tasks: + - lineinfile: + path: /etc/ssh/sshd_config + line: MaxStartups 100 + state: present + regexp: '^MaxStartups.*$' + notify: + - restart sshd + - lineinfile: + path: /etc/ssh/sshd_config + line: MaxSessions 100 + state: present + regexp: '^MaxSessions.*$' + notify: + - restart sshd + handlers: + - name: restart sshd + service: + name: "{{ ssh_service_name }}" + state: restarted + + environment: "{{ deployment_environment_variables | default({}) }}" + + tags: + - deploy-vms + + - name: Setup cinder host volume hosts: cinder_hosts:swift_hosts gather_facts: false @@ -276,3 +317,5 @@ tags: - deploy-vms + + diff --git a/multi-node-aio/playbooks/vars/ubuntu.yml b/multi-node-aio/playbooks/vars/ubuntu.yml index 6032785c..c0cb8cbc 100644 --- a/multi-node-aio/playbooks/vars/ubuntu.yml +++ b/multi-node-aio/playbooks/vars/ubuntu.yml @@ -43,3 +43,6 @@ mnaio_pkg_cache_server_distro_packages: - apt-cacher-ng mnaio_host_iptables_service: "{{ (ansible_distribution | lower + '-' + ansible_distribution_version | lower == 'ubuntu-14.04') | ternary('iptables-persistent', 'netfilter-persistent') }}" + +ssh_service_name: ssh +