Skip to content

Instantly share code, notes, and snippets.

View NetguruGist's full-sized avatar

Netguru NetguruGist

View GitHub Profile
ansible-playbook -i inventory playbook.yml
- name: “update ssh-key to admin user”
authorized_key: user=admin key="SSH_KEY" exclusive=yes
tasks:
- name: create admin account
user: name=admin shell=/bin/bash
- name: Basic server security
hosts: linux
become: true
ansible linux -i inventory -m setup
IP_ADDRESS ansible_ssh_user=ubuntu
- apt: name=logwatch state=present
- cron: name="send logwatch logs" minute="0" hour="0" job="/usr/sbin/logwatch --output mail --mailto you@example.com --detail high" state=present
- apt: name=fail2ban state=present
/etc/apt/apt.conf.d/50unattended-upgrades
- name: "Automated security updates"
apt: name=unattended-upgrades state=present
- file: path=/etc/apt/apt.conf.d/10periodic state=absent
- blockinfile:
dest: /etc/apt/apt.conf.d/10periodic