Self-notes/Ansible 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!

Enroll Now

Program 1 – Write a Ansible Adhoc Commands to create a group called “deployProgram

create group deploy name=deploy

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 deploy-user name=deploy-user shell=/bin/bashcreate group deploy name=deploy

Program 3 – Write a Ansible Adhoc commands install package named “httpd” in RHEL/centos.

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Program 4 – Write a Ansible Adhoc commands to start and enable the service named “httpd”

ansible locallhost -m yum -a”name=httpd state=present”

Program 5 – Write a Ansible commands to create a file called “index.html” in /var/www/html with some dummy html contents.

ansable localhost-m copy-a”src=index.html dest=/var/www/html/index.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.

create file index.html dest=/var/www/html/index.html mode=755 state=touch owner=root

Program 7 – Write a Ansible commands to install a package called “git”, “wget”.

install git and wget name=git,wget state=present

Program 8 – Write a Ansible Adhoc commands to clone git repo. https://github.com/scmgalaxy/ansible-role-template.

lone to git repo=https://github.com/scmgalaxy/ansible-role-template clone=yes dest=/tmp/test

Program 9 – Write a Ansible commands to reboot a self machine.

reboots the machine msg=”rebooting now…”