This commit is contained in:
1 parent
f2c4506245
commit
a8d7c01efe
9 files changed
+62
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
- name: Restart SSH
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: sshd
|
||||
state: restarted
|
||||
Whitespace-only changes.
@@ -0,0 +1,43 @@
|
||||
- name: Ensure sudo is available
|
||||
ansible.builtin.apt:
|
||||
state: present
|
||||
update_cache: true
|
||||
pkg:
|
||||
- sudo
|
||||
- zsh
|
||||
- name: Create webadmin user
|
||||
ansible.builtin.user:
|
||||
name: webadmin
|
||||
state: present
|
||||
shell: /bin/zsh
|
||||
groups:
|
||||
- nginx
|
||||
append: true
|
||||
- name: Copy webadmin public key
|
||||
ansible.posix.authorized_key:
|
||||
user: webadmin
|
||||
state: present
|
||||
key: "{{ lookup('file', 'files/webadmin.pem.pub') }}"
|
||||
- name: Add webadmin to sudoers
|
||||
ansible.builtin.copy:
|
||||
dest: "/etc/sudoers.d/webadmin"
|
||||
content: "webadmin ALL=(ALL) NOPASSWD: ALL"
|
||||
mode: "0644"
|
||||
owner: root
|
||||
group: root
|
||||
- name: Disable Password Authentication
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
line: PasswordAuthentication no
|
||||
state: present
|
||||
backup: true
|
||||
notify:
|
||||
- Restart SSH
|
||||
- name: Disable root login
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
line: PermitRootLogin no
|
||||
state: present
|
||||
backup: true
|
||||
notify:
|
||||
- Restart SSH
|
||||
Whitespace-only changes.
Whitespace-only changes.
Reference in new issue
Block a user