Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Cloud/Ansible Run Updates

June 18, 2020

Ansible Run Updates

Here’s a simple adhoc to run updates on systems in Ansible.

ansible servers -m apt -a "upgrade=yes update_cache=yes" -b

ansible servers -m apt -a "upgrade=yes update_cache=yes" -b

Results:

server | SUCCESS => {
    "changed": false, 
    "msg": "Reading package lists...
     Building dependency tree...
     Reading state information...
     Calculating upgrade...
     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.", 
    "stderr": "", 
    "stderr_lines": [], 
    "stdout": "Reading package lists...
     Building dependency tree...
     Reading state information...
     Calculating upgrade...
     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.", 
    "stdout_lines": [
        "Reading package lists...", 
        "Building dependency tree...", 
        "Reading state information...", 
        "Calculating upgrade...", 
        "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."
    ]
}

server | SUCCESS => { "changed": false, "msg": "Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.", "stderr": "", "stderr_lines": [], "stdout": "Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.", "stdout_lines": [ "Reading package lists...", "Building dependency tree...", "Reading state information...", "Calculating upgrade...", "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." ] }

If you want to reboot a remote server.

ansible servers -m "reboot" -b

ansible servers -m "reboot" -b

Filed Under: Cloud, Linux Tagged With: adhoc, ansible, reboot, updates, upgrades

About Me

I'm Ulysses, a Cloud Engineer at Cardinal Health based in Columbus, Ohio. I’m a certified AWS Solutions Architect. This website is my way of documenting the things I have learned in the Cloud. When off the grid, I enjoy riding my electric skateboard. I have surfed, snowboarded and played the saxophone in the past. I hope you will find this site helpful. It's powered by WordPress and hosted in AWS LightSail.

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021