Ansible - Random Ubuntu

Get uptime of all Ubuntu hosts:

ansible -m shell -a 'uptime' ubuntu

Get update status of all ubuntu hosts:

ansible -m shell -a '/usr/lib/update-notifier/apt-check --human-readable' ubuntu

Get upgradable packages of all ubuntu hosts:

ansible -m shell -a 'sudo apt-get update | apt list --upgradable' ubuntu

Grep relayhost of all ubuntu hosts:

ansible -m shell -a 'cat /etc/postfix/main.cf | grep relayhost' ubuntu

Check DNS servers of all ubuntu hosts:

ansible -m shell -a 'cat /etc/resolv.conf' ubuntu

Check password hash of user user on all ubuntu hosts:

ansible -m shell -a 'cat /etc/shadow | grep user' ubuntu

Get all variables from node finn:

ansible -m setup finn | grep finn

Run playbook on all except boo:

ansible-playbook --limit 'all:!bad_host' playbook.yml

Run playbook on host-ubuntu host:

ansible-playbook /etc/ansible/ubuntu_pb.yml -l host-ubuntu

Run only tag netdata from playbook on ns2:

ansible-playbook /etc/ansible/ubuntu_pb.yml --tags=netdata -l ns2
  - name: Copying custom netdata health alarms
    tags: netdata