From 3f8d83ec1755abfc472429e61804520c3b99d069 Mon Sep 17 00:00:00 2001 From: Peter Nguyen Date: Sat, 9 Nov 2024 01:59:36 +0000 Subject: [PATCH] Delete update_upgrade_os.md --- playbooks/update_upgrade_os.md | 59 ---------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 playbooks/update_upgrade_os.md diff --git a/playbooks/update_upgrade_os.md b/playbooks/update_upgrade_os.md deleted file mode 100644 index 9141dd2..0000000 --- a/playbooks/update_upgrade_os.md +++ /dev/null @@ -1,59 +0,0 @@ -Certainly! Below is an Ansible playbook to update and upgrade a Raspberry Pi system. - -```yaml ---- -- name: Update and upgrade Raspberry Pi - hosts: raspberry_pi - become: yes - tasks: - - name: Update the APT package index - apt: - update_cache: yes - - - name: Upgrade all installed packages - apt: - upgrade: yes - dist_upgrade: yes - autoremove: yes - autoclean: yes - cache_valid_time: 3600 # Cache validity time in seconds - - - name: Ensure that Raspberry Pi firmware is up to date - shell: sudo rpi-update - args: - creates: /boot/.firmware_up_to_date - - - name: Reboot if needed - reboot: - msg: "Rebooting the Raspberry Pi after update" - reboot_timeout: 600 - test_command: uptime -``` - -### Explanation of the Playbook: -- `hosts: raspberry_pi` – This refers to the group or host defined in your Ansible inventory that represents your Raspberry Pi device(s). -- `become: yes` – Ensures the playbook runs with sudo privileges for tasks that require administrative rights. - -### Tasks: -1. **Update the APT package index** – Ensures that the APT package manager has the latest information about available software packages. -2. **Upgrade all installed packages** – Installs the latest versions of all packages. The `dist_upgrade` ensures that package dependencies are also upgraded, and `autoremove` removes unnecessary packages, `autoclean` cleans up unused package files. -3. **Update Raspberry Pi firmware** – This runs `rpi-update`, a tool for upgrading the firmware on the Raspberry Pi. -4. **Reboot if needed** – Reboots the Raspberry Pi if any changes required a reboot (such as firmware updates). This ensures that the system is fully updated. - -### To run the playbook: -1. Ensure you have an inventory file that includes your Raspberry Pi host(s). Example inventory (`inventory.ini`): - - ``` - [raspberry_pi] - raspberrypi.local ansible_user=pi ansible_ssh_private_key_file=~/.ssh/id_rsa - ``` - -2. Execute the playbook using the following command: - - ```bash - ansible-playbook -i inventory.ini update_raspberry_pi.yml - ``` - -Make sure to replace `raspberrypi.local` with the actual IP or hostname of your Raspberry Pi, and adjust the SSH credentials accordingly. - -Let me know if you need further assistance! \ No newline at end of file