Update Inventory and OpenSSH Playbook

This commit is contained in:
Ben Hays 2023-11-26 15:36:02 -05:00
parent dec43e1544
commit 1ff6340e74
3 changed files with 23 additions and 3 deletions

View File

@ -8,6 +8,6 @@
[linux] [linux]
10.0.1.2 10.0.1.2
10.0.1.12 10.0.1.12
10.0.1.13
10.0.1.14 10.0.1.14
10.0.1.15 10.0.1.15
10.0.1.16

View File

@ -1,11 +1,31 @@
- hosts: linux - hosts: linux
remote_user: root remote_user: root
become: true
become_user: root
tasks: tasks:
- name: Update/install OpenSSH - name: Update/install OpenSSH
apt: apt:
name: openssh-server name: openssh-server
state: latest state: latest
update_cache: yes update_cache: yes
- name: Add 'bhays' user
user:
name: bhays
groups: sudo
append: yes
comment: Benjamin Hays
- name: Update/install Sudo
apt:
name: sudo
state: latest
- name: Ensure .ssh user folder exists
file:
path: "/home/bhays/.ssh/"
state: directory
- name: Copy public key
copy:
src: ~/.ssh/authorized_keys
dest: /home/bhays/.ssh/authorized_keys
- name: Copy Secure Configuration File - name: Copy Secure Configuration File
copy: copy:
src: ../Configs/sshd_config src: ../Configs/sshd_config

View File

@ -13,7 +13,7 @@ MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@op
LogLevel VERBOSE LogLevel VERBOSE
#LoginGraceTime 2m #LoginGraceTime 2m
#PermitRootLogin prohibit-password PermitRootLogin yes
#StrictModes yes #StrictModes yes
MaxAuthTries 5 MaxAuthTries 5
MaxSessions 8 MaxSessions 8