From d40a02067806c2a67cf7b418b078316c240cc2fc Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Wed, 3 Oct 2018 23:57:33 -0500 Subject: [PATCH] Add variable for the ssh service and ensure its enabled The ssh service on ubuntu based systems is "ssh" which is established by the service unit path `/lib/systemd/system/ssh.service`. When running the service will respond to the name "sshd" however this is just an alias. This change adds a variable to set the service unit name based on the distro family which will allow the service to start should it be masked. The change will now delegate to all nodes within the swift cluster ensuring ssh is enabled and started. If SSH is not running everywhere at the same time swift ring distribution will not be possible later on in the role. Change-Id: Ifbc748019403f0c0712d5f241f118e998d2061d4 Signed-off-by: Kevin Carter --- tasks/swift_post_install.yml | 12 ++++++++++++ vars/debian.yml | 2 ++ vars/redhat-7.yml | 2 ++ vars/suse.yml | 2 ++ 4 files changed, 18 insertions(+) diff --git a/tasks/swift_post_install.yml b/tasks/swift_post_install.yml index 64a68115..b62a20ed 100644 --- a/tasks/swift_post_install.yml +++ b/tasks/swift_post_install.yml @@ -47,3 +47,15 @@ notify: - Restart swift services - Restart rsyslog + +- name: Enable SSHD + systemd: + name: "{{ swift_sshd }}" + state: started + enabled: yes + masked: no + daemon_reload: yes + delegate_to: "{{ item }}" + with_items: "{{ groups['swift_proxy'] }}" + when: + - "inventory_hostname == ((groups['swift_proxy'] | intersect(ansible_play_hosts)) | list)[0]" diff --git a/vars/debian.yml b/vars/debian.yml index f944958b..c700c0e6 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -39,3 +39,5 @@ swift_service_distro_packages: - swift-proxy swift_rsync_service_name: rsync + +swift_sshd: ssh \ No newline at end of file diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index 15a3c14f..c0b1e035 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -39,3 +39,5 @@ swift_service_distro_packages: - python-swift swift_rsync_service_name: rsyncd + +swift_sshd: sshd \ No newline at end of file diff --git a/vars/suse.yml b/vars/suse.yml index 9f54470e..f0de0759 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -40,3 +40,5 @@ swift_service_distro_packages: - python-swift swift_rsync_service_name: rsyncd + +swift_sshd: sshd \ No newline at end of file