mirror of
https://github.com/willshersystems/ansible-sshd
synced 2025-01-11 17:50:18 +01:00
commit
a141241d1a
4 changed files with 29 additions and 18 deletions
|
@ -32,8 +32,8 @@ galaxy_info:
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- networking
|
- networking
|
||||||
- system
|
- system
|
||||||
- SSH
|
- ssh
|
||||||
- OpenSSH
|
- openssh
|
||||||
- sshd
|
- sshd
|
||||||
- server
|
- server
|
||||||
- ubuntu
|
- ubuntu
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
- name: OS is supported
|
- name: OS is supported
|
||||||
assert:
|
assert:
|
||||||
that: __sshd_os_supported == True
|
that: __sshd_os_supported|bool
|
||||||
|
|
||||||
- name: Install ssh packages
|
- name: Install ssh packages
|
||||||
package:
|
package:
|
||||||
|
@ -23,19 +23,22 @@
|
||||||
|
|
||||||
- name: Install systemd service files
|
- name: Install systemd service files
|
||||||
block:
|
block:
|
||||||
- template:
|
- name: Install service unit file
|
||||||
|
template:
|
||||||
src: "{{ sshd_service_template_service }}"
|
src: "{{ sshd_service_template_service }}"
|
||||||
dest: "/etc/systemd/system/{{ sshd_service }}.service"
|
dest: "/etc/systemd/system/{{ sshd_service }}.service"
|
||||||
notify: reload_sshd
|
notify: reload_sshd
|
||||||
- template:
|
- name: Install instanced service unit file
|
||||||
|
template:
|
||||||
src: "{{ sshd_service_template_at_service }}"
|
src: "{{ sshd_service_template_at_service }}"
|
||||||
dest: "/etc/systemd/system/{{ sshd_service }}@.service"
|
dest: "/etc/systemd/system/{{ sshd_service }}@.service"
|
||||||
notify: reload_sshd
|
notify: reload_sshd
|
||||||
- template:
|
- name: Install socket unit file
|
||||||
|
template:
|
||||||
src: "{{ sshd_service_template_socket }}"
|
src: "{{ sshd_service_template_socket }}"
|
||||||
dest: "/etc/systemd/system/{{ sshd_service }}.socket"
|
dest: "/etc/systemd/system/{{ sshd_service }}.socket"
|
||||||
notify: reload_sshd
|
notify: reload_sshd
|
||||||
when: sshd_install_service
|
when: sshd_install_service|bool
|
||||||
|
|
||||||
- name: Service enabled and running
|
- name: Service enabled and running
|
||||||
service:
|
service:
|
||||||
|
@ -43,13 +46,13 @@
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
when:
|
when:
|
||||||
- sshd_manage_service
|
- sshd_manage_service|bool
|
||||||
- ansible_virtualization_type|default(None) != 'docker'
|
- ansible_virtualization_type|default(None) != 'docker'
|
||||||
- ansible_connection != 'chroot'
|
- ansible_connection != 'chroot'
|
||||||
|
|
||||||
# Due to ansible bug 21026, cannot use service module on RHEL 7
|
# Due to ansible bug 21026, cannot use service module on RHEL 7
|
||||||
- name: Enable service in chroot
|
- name: Enable service in chroot
|
||||||
command: systemctl enable {{ sshd_service }}
|
command: systemctl enable {{ sshd_service }} # noqa 303
|
||||||
when:
|
when:
|
||||||
- ansible_connection == 'chroot'
|
- ansible_connection == 'chroot'
|
||||||
- ansible_os_family == 'RedHat'
|
- ansible_os_family == 'RedHat'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- include_tasks: sshd.yml
|
- include_tasks: sshd.yml
|
||||||
when: sshd_enable
|
when: sshd_enable|bool
|
||||||
|
|
|
@ -23,27 +23,35 @@
|
||||||
|
|
||||||
- name: Override OS defaults
|
- name: Override OS defaults
|
||||||
block:
|
block:
|
||||||
- set_fact:
|
- name: Define sshd_packages
|
||||||
|
set_fact:
|
||||||
sshd_packages: "{{ __sshd_packages }}"
|
sshd_packages: "{{ __sshd_packages }}"
|
||||||
when: sshd_packages is not defined
|
when: sshd_packages is not defined
|
||||||
- set_fact:
|
- name: Define sshd_config_owner
|
||||||
|
set_fact:
|
||||||
sshd_config_owner: "{{ __sshd_config_owner }}"
|
sshd_config_owner: "{{ __sshd_config_owner }}"
|
||||||
when: sshd_config_owner is not defined
|
when: sshd_config_owner is not defined
|
||||||
- set_fact:
|
- name: Define sshd_config_group
|
||||||
|
set_fact:
|
||||||
sshd_config_group: "{{ __sshd_config_group }}"
|
sshd_config_group: "{{ __sshd_config_group }}"
|
||||||
when: sshd_config_group is not defined
|
when: sshd_config_group is not defined
|
||||||
- set_fact:
|
- name: Define sshd_config_mode
|
||||||
|
set_fact:
|
||||||
sshd_config_mode: "{{ __sshd_config_mode }}"
|
sshd_config_mode: "{{ __sshd_config_mode }}"
|
||||||
when: sshd_config_mode is not defined
|
when: sshd_config_mode is not defined
|
||||||
- set_fact:
|
- name: Define sshd_config_file
|
||||||
|
set_fact:
|
||||||
sshd_config_file: "{{ __sshd_config_file }}"
|
sshd_config_file: "{{ __sshd_config_file }}"
|
||||||
when: sshd_config_file is not defined
|
when: sshd_config_file is not defined
|
||||||
- set_fact:
|
- name: Define sshd_binary
|
||||||
|
set_fact:
|
||||||
sshd_binary: "{{ __sshd_binary }}"
|
sshd_binary: "{{ __sshd_binary }}"
|
||||||
when: sshd_binary is not defined
|
when: sshd_binary is not defined
|
||||||
- set_fact:
|
- name: Define sshd_service
|
||||||
|
set_fact:
|
||||||
sshd_service: "{{ __sshd_service }}"
|
sshd_service: "{{ __sshd_service }}"
|
||||||
when: sshd_service is not defined
|
when: sshd_service is not defined
|
||||||
- set_fact:
|
- name: Define sshd_sftp_server
|
||||||
|
set_fact:
|
||||||
sshd_sftp_server: "{{ __sshd_sftp_server }}"
|
sshd_sftp_server: "{{ __sshd_sftp_server }}"
|
||||||
when: sshd_sftp_server is not defined
|
when: sshd_sftp_server is not defined
|
||||||
|
|
Loading…
Reference in a new issue