From 364b3d488190287e095bfc8b945588105146b181 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Fri, 25 Oct 2024 17:35:21 +0800 Subject: [PATCH] Add first playbooks --- .gitignore | 4 +++- .vscode/settings.json | 3 +++ inventory | 4 ++-- setup.yml | 35 +++++++++++++++++++++++++++++++++++ update.yml | 12 ++++++++++++ 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 setup.yml create mode 100644 update.yml diff --git a/.gitignore b/.gitignore index 256105b..0d738c0 100644 --- a/.gitignore +++ b/.gitignore @@ -165,4 +165,6 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ -**/__pycache__/ \ No newline at end of file +**/__pycache__/ + +.vscode/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a2a478d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "ansible.python.interpreterPath": "c:\\Users\\keannu125\\AppData\\Local\\Programs\\Python\\Python311\\python.exe" +} diff --git a/inventory b/inventory index 1216fd8..2fb0614 100644 --- a/inventory +++ b/inventory @@ -1,3 +1,3 @@ 10.0.10.4 -10.0.10.141 -10.0.10.64 \ No newline at end of file +10.0.10.64 +10.0.10.141 \ No newline at end of file diff --git a/setup.yml b/setup.yml new file mode 100644 index 0000000..f24ab1b --- /dev/null +++ b/setup.yml @@ -0,0 +1,35 @@ +--- +- hosts: all + # Runs on root user already + become: false + tasks: + - name: Add SSH key to authorized_hosts + authorized_key: + user: root + state: present + key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" + path: /root/.ssh/authorized_keys + - name: Update all packages + apt: + update_cache: true + autoremove: true + state: latest + - name: Install packages + apt: + name: + - vim + - nginx + - htop + - tmux + - samba + - docker + - docker-compose + - neofetch + - cifs-utils + - curl + update_cache: false + autoremove: true + state: latest + + - name: Install ACME + command: curl https://get.acme.sh | sh -s email=noehbernasol0@gmail.com diff --git a/update.yml b/update.yml new file mode 100644 index 0000000..2dd0711 --- /dev/null +++ b/update.yml @@ -0,0 +1,12 @@ +--- +- hosts: all + # Runs on root user already + become: false + tasks: + - name: Update all packages + apt: + update_cache: true + autoremove: true + state: latest + - name: Update ACME + command: /root/.acme.sh/acme.sh --upgrade --auto-upgrade