Skip to content

Commit

Permalink
Merge pull request #11 from hardening-io/use_handler
Browse files Browse the repository at this point in the history
Add handler to restart ssh only if necessary. Fix #6
  • Loading branch information
chris-rock committed Apr 28, 2015
2 parents 1d4dac1 + ef275a4 commit ad4a8a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions roles/ansible-ssh-hardening/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: restart sshd
service: name={{ sshd_service_name }} state=restarted
6 changes: 2 additions & 4 deletions roles/ansible-ssh-hardening/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
include_vars: "{{ ansible_os_family }}.yml"

- name: create sshd_config and set permissions to root/600
template: src='opensshd.conf.j2' dest='/etc/ssh/sshd_config' mode=0600 owner=root group=root
template: src='opensshd.conf.j2' dest='/etc/ssh/sshd_config' mode=0600 owner=root group=root validate="/usr/sbin/sshd -T -f %s"
notify: restart sshd

- name: create ssh_config and set permissions to root/644
template: src='openssh.conf.j2' dest='/etc/ssh/ssh_config' mode=0644 owner=root group=root

- name: restart sshd
service: name={{ sshd_service_name }} state=restarted

0 comments on commit ad4a8a0

Please sign in to comment.