blob: 01e974527e148d861ecd0e85b0f03b645520507c [file] [log] [blame]
---
- hosts: '{{ hosts }}'
become: yes
# gather_facts: no
vars:
pubkey: '~/.ssh/id_rsa.pub'
tasks:
- name: Build EC2 facts cache
ec2_facts:
- name: Build setup facts cache
setup:
- name: Copy local public keys to server for user {{ user }}
authorized_key:
user: '{{ user }}'
state: present
key: "{{ lookup('file', '{{ pubkey }}') }}"
- name: Permit root login over SSH
lineinfile:
state: present
dest: /etc/ssh/sshd_config
regexp: '(^#)(PermitRootLogin yes)'
line: '\2'
backrefs: yes
notify:
- Restart SSH service
handlers:
- name: Restart SSH service
service:
name: sshd
state: restarted