Upgrading an inventory of three servers using ansible, I can use the following command to make this happen:
ansible -i Inventory -m apt -a "upgrade=yes update_cache=yes cache_valid_time=86400" -b -B 3600 all
This command does the following:
1. Use the inventory file named "Inventory"
2. Run the Ansible module "apt"
3. Run the ad-hoc command for the apt module "upgrade=yes update_cache=yes cache_valid_time=86400"
4. The -b makes the user become sudo.
5. -B 3600 runs the command in the background, asynchronously, on all servers in the grouping, with a timeout of 3600 seconds.
6. "all" runs the command on the group named "all"