1 new message

# To create Deplo group
ansible localhost -m ansible.builtin.group -a"name=deploy state=present" -b
#To create User in deploy group
ansible localhost -m user -a"name=deploy-user password=welcome123 groups=deploy state=present shell=/bin/bash" -b
#Install httpd
ansible localhost -m yum -a"state=present name=httpd" -b
#start and enable the service named “httpd”
ansible localhost -m service -a"name=httpd state=started" -b
# create a file called “index.html” in /var/www/html with some dummy html contents.
ansible localhost -m copy -a"dest=/var/www/html src=index.html" -b

# “second.html” in /var/www/html/second.html with some dummy html contents.
ansible localhost -m copy -a"dest=/var/www/html src=second.html" -b

#install a package called “git”, “wget”
ansible localhost -m yum -a"state=present name=git" -b
ansible localhost -m yum -a"state=present name=wget" -b

#to clone git repo. https://github.com/scmgalaxy/ansible-role-template.
ansible localhost -m ansible.builtin.git -a"repo=https://github.com/scmgalaxy/ansible-role-template dest=/home/centos/monika" -b

#Restart machine
ansible localhost -m reboot

#Ansible commands to touch a file called “devopsschool.txt” in /opt/ and delete after using ansible adhoc command.
ansible localhost -m file -a"name=devopesschool.txt state=touch creates=/opt" -b
ansible localhost -m file -a"name=devopesschool.txt state=absent creates=/opt" -b