diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d71ca10 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +group_vars/all/secret.yml \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5957562 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# quantumhome diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..eecbc51 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,5 @@ +[defaults] +INVENTORY = hosts + +[ssh_connections] +pipelining = true \ No newline at end of file diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml new file mode 100644 index 0000000..2c1c855 --- /dev/null +++ b/group_vars/all/vars.yml @@ -0,0 +1,9 @@ +username: sao +packages: + - neovim + - htop + - neofetch + - lm-sensors + - hddtemp + - glances + - zsh \ No newline at end of file diff --git a/hosts b/hosts new file mode 100644 index 0000000..5eae00f --- /dev/null +++ b/hosts @@ -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 \ No newline at end of file diff --git a/run.yml b/run.yml new file mode 100644 index 0000000..2cc8aa9 --- /dev/null +++ b/run.yml @@ -0,0 +1,6 @@ +--- +- hosts: all + become: yes + + tasks: + - import_tasks: tasks/essential.yml \ No newline at end of file diff --git a/tasks/essential.yml b/tasks/essential.yml new file mode 100644 index 0000000..0a8aae3 --- /dev/null +++ b/tasks/essential.yml @@ -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 \ No newline at end of file