Ansible : Ad Hoc Commands
This article demonstrates how to run ad hoc commands using Ansible.
oracle miscconfigurationintermediate
by OracleDba
14 views
This article demonstrates how to run ad hoc commands using Ansible.
1234567
$ ansible appservers -m dnf -a "name=nginx state=present" --become
$ ansible appservers -m dnf -a "name=nginx state=latest" --become
$ ansible appservers -m dnf -a "name=nginx state=absent" --become
$ ansible appservers -m dnf -a "name=* state=latest" --become1234567
$ touch /tmp/my-file.txt
$ ansible appservers -m copy -a "src=/tmp/my-file.txt dest=/tmp/my-file.txt"
$ ansible appservers -m file -a "dest=/tmp/my-file.txt mode=777 owner=root group=root" --become
$ ansible appservers -m file -a "dest=/tmp/my-file.txt state=absent" --become1234567891011
$ ansible databases -m group -a "name=oinstall gid=54321" --become
$ ansible databases -m group -a "name=dba gid=54322" --become
$ ansible databases -m group -a "name=oper gid=54323" --become
$ ansible databases -m user -a "name=oracle password='*' uid=54321 groups='oinstall,dba,oper'" --become
$ ansible databases -m user -a "name=oracle state=absent" --become
$ ansible databases -m group -a "name=oinstall state=absent" --become
$ ansible databases -m group -a "name=dba state=absent" --become
$ ansible databases -m group -a "name=oper state=absent" --become1234567
$ ansible appservers -m dnf -a "name=nginx state=present" --become
$ ansible appservers -m service -a "name=nginx state=started" --become
$ ansible appservers -m service -a "name=nginx state=restarted" --become
$ ansible appservers -m service -a "name=nginx state=stopped" --become
$ ansible appservers -m dnf -a "name=nginx state=absent" --become1234
$ ansible databases -a "/sbin/reboot" --become
database1.localdomain | FAILED | rc=-1 >>
Failed to connect to the host via ssh: ssh: connect to host database1.localdomain port 22: Connection refused
$Please to add comments
No comments yet. Be the first to comment!