User Tools

Site Tools


ansible:ansible_cmd

This is an old revision of the document!


Ansible command examples

cmd

ansible all -m ping 
ansible foo.example.com -m yum -a "name=httpd state=installed"
ansible -i hosts all -m yum -a 'name=ncdu state=present'
ansible -i hosts all -m yum -a 'name=ncdu state=absent'
ansible foo.example.com -a "/usr/sbin/reboot"

Only way to pass a command on target without python installed

# ansible myhost --become -m raw -a "yum -y install python"
ansible-inventory --list
ansible-inventory -i ./sample.yml --graph
ansible-config dump --only-changed
ansible -m module_name -a attributes

playbook

ansible/ansible_cmd.1631141202.txt.gz · Last modified: 2021/09/09 00:46 by manu