Adhoc commands
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Program 1 â Write a Ansible Adhoc Commands to create a group called âdeploy
-create: group
group:
name: deploy
Program 2 â Write a Ansible Adhoc Commands to create a user called âdeploy-userâ which is part of group called âdeployâ and with /bin/bash shell.
-create: user
group:
name: deploy-user
group: deploy
user shell: /bin/bash shell
Program 3 â Write a Ansible Adhoc commands install package named âhttpdâ in RHEL/centos.
-install package
named: "httpd"
workstation: RHEL/centos
Program 4 â Write a Ansible Adhoc commands to start and enable the service named âhttpdâ.
-start and enable
service name: "httpd"
Program 5 â Write a Ansible commands to create a file called âindex.htmlâ in /var/www/html with some dummy html contents.
-create
file: "index.html"
dest: /var/www/html
Program 6 â Write a Ansible commands to copy a file called âsecond.htmlâ in /var/www/html/second.html with some dummy html contents.
-copy a file: "second.html"
dest: /var/www/html/second.html
Program 7 â Write a Ansible commands to install a package called âgitâ, âwgetâ.
install a package: "git" , "wget"
Program 8 â Write a Ansible Adhoc commands to clone git repo. https://github.com/scmgalaxy/ansible-role-template.
-clone: git repo
dest: https://github.com/scmgalaxy/ansible-role-template.
Program 9 â Write a Ansible commands to reboot a self machine.
-name: unconditionally reboot the machine with all defaults
Program 10 â Write a Ansible commands to touch a file called âdevopsschool.txtâ in /opt/ and delete after using ansible adhoc command.
-file: touch
dest: âdevopsschool.txtâ
file: delete