{"id":5283,"date":"2018-09-05T08:36:10","date_gmt":"2018-09-05T08:36:10","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5283"},"modified":"2021-11-17T10:00:58","modified_gmt":"2021-11-17T10:00:58","slug":"ansible-adhoc-commands-lab-excercise-part-1","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/ansible-adhoc-commands-lab-excercise-part-1\/","title":{"rendered":"Ansible Adhoc Commands Lab &#038; Excercise &#8211; Part 1"},"content":{"rendered":"<p><strong>Program 1 &#8211; Write a Ansible Adhoc Commands to create a group called &#8220;deploy<\/strong><\/p>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>How to verify?<br> $ more \/etc\/group | grep deploy<\/p><\/blockquote>\n\n\n\n<p><strong>Program 2 &#8211; Write a Ansible Adhoc Commands to create a user called &#8220;deploy-user&#8221; which is part of group called &#8220;deploy&#8221; and with \/bin\/bash shell.<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>How to verify?<br> $ more \/etc\/passwd | grep deploy-user<\/p><\/blockquote>\n\n\n\n<p><strong>Program 3 &#8211; Write a Ansible Adhoc commands install package named &#8220;httpd&#8221; in RHEL\/centos.<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>How to verify?<br> $ which httpd<\/p><\/blockquote>\n\n\n\n<p><strong>Program 4 &#8211; Write a Ansible Adhoc commands to start and enable the service named &#8220;httpd&#8221;<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>How to verify?<br> $ ps -eaf | grep httpd<\/p><\/blockquote>\n\n\n\n<p><strong>Program 5 &#8211; Write a Ansible commands to create a file called &#8220;index.html&#8221; in \/var\/www\/html with some dummy html contents.<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>How to verify?<br> Browse http:\/\/x.x.x.x:80<\/p><\/blockquote>\n\n\n\n<p><strong>Program 6 &#8211; Write a Ansible commands to copy a file called &#8220;second.html&#8221; in \/var\/www\/html\/second.html with some dummy html contents.<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>How to verify?<br> Browse http:\/\/x.x.x.x\/second.html<\/p><\/blockquote>\n\n\n\n<p><strong>Program 7 &#8211; Write a Ansible commands to install a package called &#8220;git&#8221;, &#8220;wget&#8221;.<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>How to verify?<br> $ which git<br> $ which wget<\/p><\/blockquote>\n\n\n\n<p><strong>Program 8 &#8211; Write a Ansible Adhoc commands to clone git repo. https:\/\/github.com\/scmgalaxy\/ansible-role-template.<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>How to verify?<br> $ ls<\/p><\/blockquote>\n\n\n\n<p><strong>Program 9 &#8211; Write a Ansible commands to reboot a self machine.<\/strong><\/p>\n\n\n\n<p><strong>Program 10 &#8211; Write a Ansible commands to touch a file called &#8220;devopsschool.txt&#8221; in \/opt\/ and delete after using ansible adhoc command.<\/strong><\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_71642\"><iframe loading=\"lazy\"  id=\"_ytid_97031\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_71642\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Program 1 &#8211; Write a Ansible Adhoc Commands to create a group called &#8220;deploy How to verify? $ more \/etc\/group | grep deploy Program 2 &#8211; Write a Ansible Adhoc&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5038],"tags":[5039,639,378,5035,5036],"class_list":["post-5283","post","type-post","status-publish","format-standard","hentry","category-ansible","tag-adhoc","tag-ansible","tag-commands","tag-excercise","tag-lab"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=5283"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5283\/revisions"}],"predecessor-version":[{"id":25583,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5283\/revisions\/25583"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=5283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=5283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=5283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}