Skip to content

Instantly share code, notes, and snippets.

@jmlrt
Created April 12, 2017 06:23
Show Gist options
  • Select an option

  • Save jmlrt/eb3b7a2fce94e7b216887754af76a3db to your computer and use it in GitHub Desktop.

Select an option

Save jmlrt/eb3b7a2fce94e7b216887754af76a3db to your computer and use it in GitHub Desktop.
Ansible C1 Playbook
---
- hosts: c1
become: yes
tasks:
- name: ensure ssh root login is disabled
lineinfile:
dest: /etc/ssh/sshd_config
state: present
regexp: "^PermitRootLogin"
line: PermitRootLogin no
notify: reload ssh
tags: ssh
- name: ensure ssh password login is disabled
lineinfile:
dest: /etc/ssh/sshd_config
state: present
regexp: "^PasswordAuthentication"
line: PasswordAuthentication no
notify: reload ssh
tags: ssh
handlers:
- name: reload ssh
service:
name: ssh
state: reloaded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment