From 5f85fb0448a0ebdb55ae97c1e13815966238a862 Mon Sep 17 00:00:00 2001 From: jacqueskingram Date: Fri, 14 Feb 2025 08:20:54 -0500 Subject: [PATCH] Initial commit of ansible-project --- add_keys.yaml | 5 +++++ hosts | 2 ++ README.md => update-playbook/README.md | 0 update_upgrade.yaml | 12 ++++++++++++ 4 files changed, 19 insertions(+) create mode 100644 add_keys.yaml create mode 100644 hosts rename README.md => update-playbook/README.md (100%) create mode 100644 update_upgrade.yaml diff --git a/add_keys.yaml b/add_keys.yaml new file mode 100644 index 0000000..5b83460 --- /dev/null +++ b/add_keys.yaml @@ -0,0 +1,5 @@ +- name: Add SSH public key to authorized_keys + authorized_key: + user: jacques # User on the remote VM + key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" # Path to your local public key + state: present diff --git a/hosts b/hosts new file mode 100644 index 0000000..f8ff69f --- /dev/null +++ b/hosts @@ -0,0 +1,2 @@ +[servers] +xochi.jacquesingram.online ansible_user=jacques diff --git a/README.md b/update-playbook/README.md similarity index 100% rename from README.md rename to update-playbook/README.md diff --git a/update_upgrade.yaml b/update_upgrade.yaml new file mode 100644 index 0000000..77b7104 --- /dev/null +++ b/update_upgrade.yaml @@ -0,0 +1,12 @@ +--- +- hosts: servers # Targets the "servers" group defined in your inventory + become: true # Important: This enables privilege escalation (sudo) + become_user: root # Explicitly become root (optional, but good practice) + tasks: + - name: Update apt cache + apt: + update_cache: yes + + - name: Upgrade packages + apt: + upgrade: yes