From 81b6671536eb834d3d9dbfd193f57c3926dfac6a Mon Sep 17 00:00:00 2001 From: Brian King Date: Fri, 9 Sep 2016 15:50:50 +0200 Subject: [PATCH] Adapt config / installed packages to allow keeping systemd --- CHANGELOG.md | 1 + provisioning/roles/base/tasks/main.yml | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1bba80..84c0ef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ For migration information, you can always have a look at https://liip-drifter.re - fix the default nginx vhost when setting up an index file - flush handlers at the end of relevent roles to ensure services are available - fix an error where the destination directory contains spaces +- ensure libpam-systemd installed and sshd configured to use it; this obviates the need to remove systemd ## [1.0.6] - 2016-08-12 diff --git a/provisioning/roles/base/tasks/main.yml b/provisioning/roles/base/tasks/main.yml index ab827c5..e4c4013 100644 --- a/provisioning/roles/base/tasks/main.yml +++ b/provisioning/roles/base/tasks/main.yml @@ -1,12 +1,8 @@ +# python-apt is needed for the Ansible 'apt' module, used later in this file. - name: ensure python-apt is installed command: apt-get install -y python-apt creates=/usr/share/pyshared/apt become: yes -- name: remove systemd on Debian - apt: name=systemd state=absent - become: yes - when: "ansible_distribution == 'Debian'" - - name: ensure apt database is up-to-date apt: update_cache=yes become: yes @@ -47,6 +43,24 @@ - ncurses-term - python-pycurl # needed by ansible to add apt repos +# Avoid vagrant problem specific to debian guests, see https://github.com/mitchellh/vagrant/issues/6207#issuecomment-234332985 +# If systemd is installed, ensure that libpam-systemd is installed too, and enable it in the sshd config. +- name: Check if systemd is installed + shell: dpkg-query -W 'systemd' + ignore_errors: True + register: systemd_installed + +- name: ensure libpam-systemd is installed if systemd is installed + apt: pkg=libpam-systemd + become: yes + when: systemd_installed|success + +- name: Ensure UsePAM sshd config set if systemd is installed + lineinfile: dest=/etc/ssh/sshd_config line='UsePAM yes' state=present + notify: restart ssh + become: yes + when: systemd_installed|success + # Some programs such as PostgreSQL use the current locale to create the base # databases. If the locale is set to a value that isn't installed on the # system, PostgreSQL installation will fail