{"id":5649,"date":"2018-11-30T06:49:02","date_gmt":"2018-11-30T06:49:02","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=5649"},"modified":"2021-11-17T06:19:10","modified_gmt":"2021-11-17T06:19:10","slug":"ansible-role-project-1","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/ansible-role-project-1\/","title":{"rendered":"Ansible Role Project 1"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5653\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/11\/Ansible-Role.png\" alt=\"\" width=\"400\" height=\"215\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/11\/Ansible-Role.png 400w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/11\/Ansible-Role-300x161.png 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/p>\n<p>Step 1 &#8211; Create a role which has following specification.<\/p>\n<ul>\n<li>Install a webserver httpd # use role\/vars\/<\/li>\n<li>Add cond&#8230;httpd should be done only if RHEL.<\/li>\n<li>Copy a index.j2 into \/var\/www\/html # Use Template<\/li>\n<li>Copy a httpd.j2 into \/etc\/httpd\/conf\/httpd.conf and change the port from 80 to 8080 # Use Template<\/li>\n<li>Write a handler for httpd.conf changes for restartting a httpd<\/li>\n<li>Run one Shell Script<\/li>\n<li>Whatever the outout of Shell Script should register into vars and display in index.html<\/li>\n<li>Create one linux group called &#8220;deloitte&#8221; and user called &#8220;deploy&#8221;<\/li>\n<li>index.j2 should have few fact vars, prompt vars, role\/vars and inventory vars. All of them are duplicate but with<\/li>\n<li>the same value.<\/li>\n<li>Install a git, ntp and vim tools using ansible looping\/iterators<\/li>\n<\/ul>\n<p>Step 2 &#8211; Download a role fromm ansible galaxy which can install jdk in RHEL.<\/p>\n<p>Step 3 &#8211; Call Both role from site.yaml<\/p>\n<p>Step 4 &#8211; &#8220;Step 2&#8221; role is dependent on &#8220;Step 1&#8221;.<\/p>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_44862\"><iframe loading=\"lazy\"  id=\"_ytid_15937\"  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_44862\"  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>Step 1 &#8211; Create a role which has following specification. Install a webserver httpd # use role\/vars\/ Add cond&#8230;httpd should be done only if RHEL. Copy a index.j2 into \/var\/www\/html&#8230; <\/p>\n","protected":false},"author":1,"featured_media":5653,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5038],"tags":[639,5142,5040,2339,852],"class_list":["post-5649","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ansible","tag-ansible","tag-galaxy","tag-playbook","tag-project","tag-role"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5649","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=5649"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5649\/revisions"}],"predecessor-version":[{"id":25541,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5649\/revisions\/25541"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/5653"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=5649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=5649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=5649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}