Skip to content

Commit

Permalink
Essential Homeserver setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon Holm committed Jan 8, 2022
0 parents commit 45846c7
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
group_vars/all/secret.yml
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# quantumhome
5 changes: 5 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[defaults]
INVENTORY = hosts

[ssh_connections]
pipelining = true
9 changes: 9 additions & 0 deletions group_vars/all/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
username: sao
packages:
- neovim
- htop
- neofetch
- lm-sensors
- hddtemp
- glances
- zsh
2 changes: 2 additions & 0 deletions hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[home]
homesever ansible_host=192.168.178.96 ansible_user="{{ username }}" ansible_connection=ssh ansible_ssh_private_key_file=/home/leonholm/.ssh/quantumhome
6 changes: 6 additions & 0 deletions run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: all
become: yes

tasks:
- import_tasks: tasks/essential.yml
29 changes: 29 additions & 0 deletions tasks/essential.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- name: Update packages
apt:
update_cache: yes
upgrade: yes

- name: Install essential packages
package:
name: "{{ packages }}"
state: latest

- name: Disable SSH password auth
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^#PasswordAuthentication yes"
line: "PasswordAuthentication no"
register: sshd_config

- name: Enable passwordless sudo for "{{ username }}"
lineinfile:
dest: /etc/sudoers
regexp: "^%wheel"
line: "{{ username }} ALL=(ALL) NOPASSWD: ALL"
validate: "/usr/sbin/visudo -cf %s"

- name: Restart SSH daemon
service:
name: sshd
state: restarted
when: sshd_config.changed

0 comments on commit 45846c7

Please sign in to comment.