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
This commit is contained in:
Shannon Mitchell 2018-03-02 09:54:34 -06:00
parent 2ebd3d789f
commit 4cbb0d8b98
2 changed files with 46 additions and 0 deletions

View File

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

View File

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