2014-12-18 23:12:51 +01:00
|
|
|
---
|
2015-01-13 14:26:52 +01:00
|
|
|
- name: Set OS dependent variables
|
2014-12-18 23:12:51 +01:00
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
2015-01-04 16:49:35 +01:00
|
|
|
- "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml"
|
2014-12-22 21:18:35 +01:00
|
|
|
- "{{ ansible_distribution }}.yml"
|
2015-01-04 16:49:35 +01:00
|
|
|
- "{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml"
|
2014-12-18 23:12:51 +01:00
|
|
|
- "{{ ansible_os_family }}.yml"
|
2015-01-15 11:26:40 +01:00
|
|
|
- default.yml
|
2014-12-25 21:02:44 +01:00
|
|
|
tags:
|
|
|
|
- sshd
|
2014-12-18 23:12:51 +01:00
|
|
|
|
2015-01-13 18:41:56 +01:00
|
|
|
- name: OS is supported
|
|
|
|
assert:
|
|
|
|
that: sshd_os_supported == True
|
2015-06-28 11:18:45 +02:00
|
|
|
tags:
|
|
|
|
- sshd
|
2015-01-13 18:41:56 +01:00
|
|
|
|
2014-12-21 21:29:13 +01:00
|
|
|
- name: Installed
|
|
|
|
action: >
|
|
|
|
{{ ansible_pkg_mgr }}
|
|
|
|
name="{{ item }}"
|
|
|
|
state=installed
|
2016-03-08 18:00:56 +01:00
|
|
|
with_items: "{{ sshd_packages }}"
|
2016-12-22 14:48:27 +01:00
|
|
|
when: ansible_pkg_mgr != 'unknown'
|
2014-12-25 21:02:44 +01:00
|
|
|
tags:
|
|
|
|
- sshd
|
2014-12-21 21:29:13 +01:00
|
|
|
|
2015-06-25 16:13:10 +02:00
|
|
|
- name: Run directory
|
|
|
|
file:
|
|
|
|
path: /var/run/sshd
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
2015-08-12 17:41:46 +02:00
|
|
|
when: sshd_manage_var_run
|
2015-06-25 16:13:10 +02:00
|
|
|
tags:
|
|
|
|
- sshd
|
|
|
|
|
2015-01-13 14:26:52 +01:00
|
|
|
- name: Configuration
|
2014-12-18 23:12:51 +01:00
|
|
|
template:
|
|
|
|
src: sshd_config.j2
|
|
|
|
dest: "{{ sshd_config_file }}"
|
2014-12-22 10:25:31 +01:00
|
|
|
owner: "{{ sshd_config_owner }}"
|
|
|
|
group: "{{ sshd_config_group }}"
|
2014-12-22 11:05:09 +01:00
|
|
|
mode: "{{ sshd_config_mode }}"
|
2015-06-26 12:38:09 +02:00
|
|
|
validate: "{{ sshd_binary }} -t -f %s"
|
|
|
|
notify: reload_sshd
|
2014-12-25 21:02:44 +01:00
|
|
|
tags:
|
|
|
|
- sshd
|
2014-12-21 21:29:13 +01:00
|
|
|
|
|
|
|
- name: Service enabled and running
|
|
|
|
service:
|
|
|
|
name: "{{ sshd_service }}"
|
|
|
|
enabled: true
|
2017-03-16 14:06:16 +01:00
|
|
|
state: started
|
2015-06-25 15:54:24 +02:00
|
|
|
when: sshd_manage_service
|
2014-12-25 21:02:44 +01:00
|
|
|
tags:
|
|
|
|
- sshd
|
2015-01-14 20:44:17 +01:00
|
|
|
|
|
|
|
- name: Register that this role has run
|
|
|
|
set_fact: sshd_has_run=true
|
|
|
|
when: sshd_has_run is not defined
|
2015-06-28 11:18:45 +02:00
|
|
|
tags:
|
|
|
|
- sshd
|