How to update Raspbian on your Raspberry Pi using Ansible using CLI or Playbook(Part 2)
TechBytes with Ron Nutter
In this episode, I show you how to update Raspbian on your Raspberry Pi using both command line and Playbook forms of Ansible.
Ansible CLI
Upgrade all the server_name servers.
ansible server_name -m apt -a "upgrade=yes update_cache=yes" -b
Ansible Playbook #name: Basic Update
- hosts: Ansible
become: true
become_user: root
tasks:
- name: Update apt repo and cache apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
- name: Upgrade modules apt: upgrade=yes
Manually run this line on specific RPI host
grep -E "^$(date +%Y-%m-%d).+ (install|upgrade) " /var/log/dpkg.log |cut -d " " -f 3-5
Sample Output pi@Ansible:/etc/ansible $ ansible-playbook update-basic.yml
PLAY [Ansible] ************************************************************************************************************************************
TASK [Gathering Facts] **************************************************************************************************************************** ok: [10.0.1.193]
TASK [Update apt repo and cache] ****************************************************************************************************************** ok: [10.0.1.193]
TASK [Upgrade modules] **************************************************************************************************************************** [WARNING]: Could not find aptitude. Using apt-get instead.
ok: [10.0.1.193]
PLAY RECAP **************************************************************************************************************************************** 10.0.1.193 : ok=3 changed=0 unreachable=0 failed=0
================================================ *** Show Notes, Links and Resources **** Here are the items mentioned in this video -
LABISTS Raspberry Pi 4 Complete Starter Kit with Pi 4 Model B 1GB https://amzn.to/32n9Gub
Get Your SmartHome Device Checklist here - http://eepurl.com/goDE49
➥➥➥ SUBSCRIBE FOR MORE VIDEOS ➥➥➥ Never miss a video about creating your own smart home Subscribe ⇢ http://ronaldnutter.com/subscribe
To listen to an audio version of this episode while driving, TechBytes with Ron Nutter is available on iTunes, Google Podcasts, Stitcher and TuneIn. Go to TechByteswithRonNutter.com to subscribe today!
To subscribe to the TechbytesRN newsletter, click here - http://ronaldnutter.com/sample1 In return for subscribing to the newsletter, I will send you a chapter from my first DIY Smart Home Guide Book.
Visit http://www.ronaldnutter.com to see all the books Ron has written
DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small ... https://www.youtube.com/watch?v=l0gGVxtUyyM
109099637 Bytes