Self-notes/Ansible

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

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

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

Install the httpd apps name=httpd

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

start the httpd service name=httpd state=enable name=httpd state=started

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/index.html mode=755 state=touch owner=root

dest=/var/www/html/index.html line=’\n

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…”