From a6476c3f5b6b4707c3a177cd1ed68ef6f804de51 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Thu, 15 Oct 2020 11:25:36 +0300 Subject: [PATCH] Increase amount of MaxSessions For running bigger amount of ansible forks, we need to increase ssh MaxSessions parameter for lxc hosts, since all connections to lxc containers occur through hosts Depends-On: https://review.opendev.org/758399 Change-Id: Ib3e850ba79658a42995cd782a11342aca6858342 --- handlers/main.yml | 6 ++++++ tasks/lxc_post_install.yml | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/handlers/main.yml b/handlers/main.yml index 8d365f5f..a51c3577 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -93,6 +93,12 @@ name: it_does_not_matter daemon_reload: yes +- name: Restart sshd + service: + name: sshd + state: "restarted" + enabled: yes + - name: Remove rootfs archive file: path: "/tmp/{{ cache_basename }}" diff --git a/tasks/lxc_post_install.yml b/tasks/lxc_post_install.yml index f8eee2d3..34479242 100644 --- a/tasks/lxc_post_install.yml +++ b/tasks/lxc_post_install.yml @@ -63,6 +63,17 @@ tags: - lxc-config +- name: Set sshd MaxSessions + lineinfile: + dest: /etc/ssh/sshd_config + state: present + regexp: "^#?MaxSessions.*$" + line: "MaxSessions 50" + notify: + - Restart sshd + tags: + - lxc-config + # NOTE(hwoarang): The previous task only affected newly created services. # However, for particular systemd versions like v228 the default one for # started scopes is 512