<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sreepada &#8211; Best DevOps</title>
	<atom:link href="https://www.bestdevops.com/author/sreepada/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.bestdevops.com</link>
	<description>Lets Learn, Do it &#38; Share! Thats a Best DevOps!!!</description>
	<lastBuildDate>Fri, 17 Dec 2021 06:53:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>
	<item>
		<title>Ansible Multiple playbook exercise</title>
		<link>https://www.bestdevops.com/ansible-multiple-playbook-exercise/</link>
		
		<dc:creator><![CDATA[Sreepada]]></dc:creator>
		<pubDate>Tue, 07 Sep 2021 05:35:00 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=21044</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><span><code class="hljs language-php">

<span class="hljs-number">1.</span> Write a <span class="hljs-number">3</span> yaml playbook i.e main.yaml, second.yaml <span class="hljs-keyword">and</span> third.yaml with some demo debug tasks <span class="hljs-keyword">and</span> call second.yaml <span class="hljs-keyword">and</span> third.yaml from main.yaml using inlcude.

-------------------------------------second.yaml-------------------------------

---
- name: Update web servers
  hosts: web

  tasks:
  - name: Install the latest version of Apache
    yum:
      name={{ packagename }}
      state=latest
  - name: Copy file with owner <span class="hljs-keyword">and</span> permissions
    ansible.builtin.copy:
      src: index.html
      dest: /<span class="hljs-keyword">var</span>/www/html/index.html

--------------------------------------third.yaml----------------------------------

- name: Update web servers
  hosts: db

  tasks:
  - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name={{ servicename }}
      state=started
  - name: <span class="hljs-keyword">include</span> <span class="hljs-keyword">default</span> step variables
    include_vars: <span class="hljs-keyword">var</span>-<span class="hljs-keyword">include</span>.yml
  - name: <span class="hljs-keyword">Print</span> the vars
    ansible.builtin.debug:
      msg: My name {{ myname }} <span class="hljs-keyword">and</span> My age is {{ age }}

 ------------------------------------main.py-------------------------------------
 - <span class="hljs-keyword">include</span>: second.yaml
 - <span class="hljs-keyword">include</span>: third.yaml

</code></span></pre>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ansible playbook lab exercise part-3</title>
		<link>https://www.bestdevops.com/ansible-playbook-lab-exercise-part-3/</link>
		
		<dc:creator><![CDATA[Sreepada]]></dc:creator>
		<pubDate>Mon, 06 Sep 2021 12:17:56 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=21021</guid>

					<description><![CDATA[Create a playbook where you should install a webserver into 2 OS type(Ubuntu and RHEL) with fact conditioning. and list [&#8230;]]]></description>
										<content:encoded><![CDATA[
<ol class="wp-block-list"><li>Create a playbook where you should install a webserver into 2 OS type(Ubuntu and RHEL) with fact conditioning. and list out a directory which in “/etc” and display such as “This is a directory /file in /etc:-XXXx” To be used Conditiong, looping, regiter and fact variable.</li></ol>


<pre class="wp-block-code"><span><code class="hljs language-php">---
- name: Install webserver on <span class="hljs-number">2</span> os <span class="hljs-keyword">and</span> display directory contents
  hosts: localhost
  
  tasks:
  - name: Install httpd on redhat os
    yum:
      name=httpd
      state=latest
    when: ansible_os_family == <span class="hljs-string">"RedHat"</span>
  - name: Install apache2 on ubuntu
    apt:
      name=apache2
      state=latest
    when: ansible_os_family == <span class="hljs-string">"Ubuntu"</span>
  - name: <span class="hljs-keyword">List</span> contents in /etc
      shell: ls /etc
      register: contents
  - name: <span class="hljs-keyword">Print</span> /etc contents
      debug:
        msg: <span class="hljs-string">"This is a directory /file in /etc : {{ item }}"</span>
      loop: <span class="hljs-string">"{{ contents.stdout_lines }}"</span></code></span></pre>

<pre class="wp-block-code"><span><code class="hljs language-javascript"><span class="hljs-number">2.</span> There are <span class="hljs-number">2</span> environment DEV and QA. Both has their own group_vars. Using it, <span class="hljs-keyword">in</span> Dev and QA environment(RHEL/CENTOS) install apache and Dev should run <span class="hljs-keyword">with</span> <span class="hljs-number">80</span> port and QA should run <span class="hljs-keyword">with</span> <span class="hljs-number">8080</span> port. Whereas config file locaton <span class="hljs-keyword">for</span> apache conf is /etc/httpd.conf/conf/httpd.conf and line <span class="hljs-keyword">for</span> port is “Listen <span class="hljs-number">80</span>”. This should be done using template <span class="hljs-built_in">module</span> and zinja2 lib.

---
- name: Install dev and qa environment
  <span class="hljs-attr">hosts</span>: web
  <span class="hljs-attr">vars_files</span>:
    - ext-vars.yaml
	
  <span class="hljs-attr">tasks</span>:
  - name: Install httpd
    <span class="hljs-attr">yum</span>:
      name=httpd
      state=latest
    <span class="hljs-attr">when</span>: ansible_os_family == <span class="hljs-string">"RedHat"</span>
  - name: Install apache2
    <span class="hljs-attr">apt</span>:
      name=apache2
      state=latest
    <span class="hljs-attr">when</span>: ansible_os_family == <span class="hljs-string">"Ubuntu"</span>  

  - name: Template a file to /etc/file.conf
    ansible.builtin.template:
      src: httpd.conf.j2
      <span class="hljs-attr">dest</span>: <span class="hljs-regexp">/etc/</span>httpd/conf/httpd.conf
     <span class="hljs-attr">notify</span>:
      - Start service httpd, <span class="hljs-keyword">if</span> not started

  - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name=httpd
      state=started

  <span class="hljs-attr">handlers</span>:
  - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name=httpd
      state=restarted

</code></span></pre>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ansible variable lab exercise</title>
		<link>https://www.bestdevops.com/ansible-variable-lab-exercise/</link>
		
		<dc:creator><![CDATA[Sreepada]]></dc:creator>
		<pubDate>Mon, 06 Sep 2021 10:59:06 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=21014</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><span><code class="hljs language-javascript"><span class="hljs-number">1.</span> Create a playbook and setup a webserver(httpd) and use httpd <span class="hljs-keyword">as</span> a variable decalared <span class="hljs-keyword">in</span> role <span class="hljs-keyword">var</span> file

---
- name: Setup web server
  <span class="hljs-attr">hosts</span>: web
  <span class="hljs-attr">vars_files</span>:
    - ext-vars.yaml
   
  <span class="hljs-attr">tasks</span>:
  - name: Install httpd
    <span class="hljs-attr">yum</span>:
      name={{ packagename }}
      state=present
  - name: Copy file <span class="hljs-keyword">with</span> owner and permissions
    ansible.builtin.copy:
      src: index.html
      <span class="hljs-attr">dest</span>: <span class="hljs-regexp">/var/</span>www/html/index.html
  - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name={{ servicename }}
      state=started</code></span></pre>

<pre class="wp-block-code"><span><code class="hljs language-javascript"><span class="hljs-number">2.</span>  Create a playbook and setup a webserver(httpd) and use httpd <span class="hljs-keyword">as</span> a variable decalared using prompt

---
- name: Setup httpd server
  <span class="hljs-attr">hosts</span>: web
  <span class="hljs-attr">vars_prompt</span>:
    - name: <span class="hljs-string">"packagename"</span>
      <span class="hljs-attr">prompt</span>: <span class="hljs-string">"package-name"</span>
   
  <span class="hljs-attr">tasks</span>:
  - name: Install httpd
    <span class="hljs-attr">yum</span>:
      name={{ packagename }}
      state=latest
  - name: Copy file <span class="hljs-keyword">with</span> owner and permissions
    ansible.builtin.copy:
      src: index.html
      <span class="hljs-attr">dest</span>: <span class="hljs-regexp">/var/</span>www/html/index.html
  - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name={{ packagename }}
      state=started
  - name: Print the vars
    ansible.builtin.debug:
      msg: package {{ packagename }} installed</code></span></pre>

<pre class="wp-block-code"><span><code class="hljs language-javascript"><span class="hljs-number">3.</span> Create a playbook and setup a webserver(httpd) and find a list <span class="hljs-keyword">of</span> .txt file <span class="hljs-keyword">in</span> some directory and output using register variables

---
- name: Setup httpd server
  <span class="hljs-attr">hosts</span>: web
  <span class="hljs-attr">vars</span>:
    packagename: httpd
    <span class="hljs-attr">servicename</span>: httpd
    <span class="hljs-attr">name</span>: sreepada
	
  <span class="hljs-attr">tasks</span>:
  - name: Install httpd
    <span class="hljs-attr">yum</span>:
      name={{ packagename }}
      state=latest
  - name: Copy file <span class="hljs-keyword">with</span> owner and permissions
    ansible.builtin.copy:
      src: index.html
      <span class="hljs-attr">dest</span>: <span class="hljs-regexp">/var/</span>www/html/index.html
  - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name={{ servicename }}
      state=started
  - name: Ansible register variable example
    <span class="hljs-attr">shell</span>: <span class="hljs-string">"find *.txt"</span>
    <span class="hljs-attr">args</span>:
      chdir: <span class="hljs-string">"/home/centos/ansible/sreepada"</span>
    <span class="hljs-attr">register</span>: find_output
  - debug:
      <span class="hljs-keyword">var</span>: find_output.stdout_lines&#91;<span class="hljs-number">0</span>]</code></span></pre>

<pre class="wp-block-code"><span><code class="hljs language-javascript"><span class="hljs-number">4.</span> Create a playbook and setup a webserver(httpd), copy a index.html and interpolate variables <span class="hljs-keyword">in</span> template file decalared <span class="hljs-keyword">in</span> playbook.

---
- name: Setup httpd server
  <span class="hljs-attr">hosts</span>: web
  <span class="hljs-attr">vars</span>:
    myname: sreepada
    <span class="hljs-attr">age</span>: <span class="hljs-number">23</span>
  <span class="hljs-attr">tasks</span>:
  - name: Install httpd
    <span class="hljs-attr">yum</span>:
      name=httpd  
      state=latest	  
  - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name=httpd
      state=started
  - name: Template a file to /<span class="hljs-keyword">var</span>/www/html/
    ansible.builtin.template:
      src: index.html.j2
      <span class="hljs-attr">dest</span>: <span class="hljs-regexp">/var/</span>www/html/index.html</code></span></pre>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ansible Playbook Lab-2</title>
		<link>https://www.bestdevops.com/ansible-playbook-lab-2/</link>
		
		<dc:creator><![CDATA[Sreepada]]></dc:creator>
		<pubDate>Mon, 06 Sep 2021 05:50:58 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=20968</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><span><code class="hljs language-php">---
- name: Create a Deploy group
  hosts: web

  tasks:
  - name: create group <span class="hljs-string">"deploy"</span>
    group:
      name: deploy
      state: present

---
- name: Create a user <span class="hljs-string">"deploy-user"</span>
  hosts: web

  tasks:
  - name: create a user <span class="hljs-string">"deploy-user"</span>
    user:
      name=deploy-user groups=deploy shell=/bin/bash
      state=present

---
- name: Install package httpd server
  hosts: web

  tasks:
  - name: Install package httpd
    yum:
      name=httpd
      state=absent

---
- name: To start <span class="hljs-keyword">and</span> enable httpd service
  hosts: web

  tasks:
  - name: start httpd
    service:
      name: httpd
      state: started

  - name: enable httpd
    service:
      name: httpd
      enabled: yes

---
- name: creat a file index.html in path
  hosts: web

  tasks:
  - name: create a file index.html
    file:
      path: <span class="hljs-string">"/var/www/htmlindex.html"</span>
      state: touch

---
- name: Reboot <span class="hljs-keyword">self</span> machine
  hosts: web

  tasks:
  - name: Reboot <span class="hljs-keyword">self</span> machine
    reboot:
      reboot_timeout: <span class="hljs-number">3600</span>

---
- name: Reboot <span class="hljs-keyword">self</span> machine
  hosts: web

  tasks:
  - name: Reboot <span class="hljs-keyword">self</span> machine
    reboot:
      reboot_timeout: <span class="hljs-number">3600</span>

---
- name: To install a package git,wget
  hosts: web

  tasks:
  - name: Install git
    yum:
      name: git
      state: present

  - name: Install wget
    yum:
      name: wget
      state: latest

---
- name: <span class="hljs-keyword">Clone</span> git repo
  hosts: web

  tasks:
  - name: <span class="hljs-keyword">clone</span> git repo
    git:
      dest: /home/centos/bhavya
      repo: <span class="hljs-string">"https://github.com/scmgalaxy/ansible-role-template"</span>
      <span class="hljs-keyword">clone</span>: yes
</code></span></pre>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Install Ansible and run ADHOC commands to setup httpd server</title>
		<link>https://www.bestdevops.com/install-ansible-and-run-adhoc-commands-to-setup-httpd-server/</link>
		
		<dc:creator><![CDATA[Sreepada]]></dc:creator>
		<pubDate>Sat, 04 Sep 2021 07:17:39 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=20861</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><span><code class="hljs language-javascript"><span class="hljs-number">1.</span>ansible localhost -m ansible.builtin.group -a<span class="hljs-string">"name=deploy state=present"</span> -b
<span class="hljs-number">2.</span>ansible localhost -m ansible.builtin.user -a <span class="hljs-string">"name=deploy-user password=devops@345 group=deploy state=present shell=/bin/bash"</span> -b
<span class="hljs-number">3.</span>ansible localhost -m yum -a<span class="hljs-string">"state=present name=httpd"</span> -b
<span class="hljs-number">4.</span>ansible localhost -m service -a<span class="hljs-string">"name=httpd state=started"</span> -b
<span class="hljs-number">5.</span>ansible localhost -m file -a<span class="hljs-string">"path=/var/www/html state=directory"</span>
<span class="hljs-number">6.</span>ansible localhost -m copy -a<span class="hljs-string">"dest=/var/www/html src=second.html"</span> -b
<span class="hljs-number">7.</span>ansible localhost -m yum -a<span class="hljs-string">"state=present name=git"</span> -b
  ansible localhost -m yum -a<span class="hljs-string">"state=present name=wget"</span> -b
<span class="hljs-number">8.</span>ansible localhost -m ansible.builtin.git -a<span class="hljs-string">"repo=https://github.com/scmgalaxy/ansible-role-template dest=/home/centos/sreepada clone=yes"</span> -b
<span class="hljs-number">9.</span>ansible localhost -m reboot</code></span></pre>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>What is devops and how it works</title>
		<link>https://www.bestdevops.com/what-is-devops-and-how-it-works/</link>
		
		<dc:creator><![CDATA[Sreepada]]></dc:creator>
		<pubDate>Sat, 04 Sep 2021 06:09:36 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=20835</guid>

					<description><![CDATA[Ansible is a configuration management tool where the server(s) (hardware and software)configurations can be automated. It is owned by RedHat [&#8230;]]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full is-style-default"><img fetchpriority="high" decoding="async" width="768" height="546" src="https://www.bestdevops.com/wp-content/uploads/2021/09/ansible.png" alt="" class="wp-image-20841" srcset="https://www.bestdevops.com/wp-content/uploads/2021/09/ansible.png 768w, https://www.bestdevops.com/wp-content/uploads/2021/09/ansible-300x213.png 300w, https://www.bestdevops.com/wp-content/uploads/2021/09/ansible-100x70.png 100w" sizes="(max-width: 768px) 100vw, 768px" /></figure>



<p class="wp-block-paragraph">Ansible is a configuration management tool where the server(s) (hardware and software)configurations can be automated. It is owned by RedHat and is open source and is written in python.</p>



<p class="wp-block-paragraph">It is easy to use and can run on any machine (linux or windows) ad helps in managing server(s) configuration management</p>



<p class="wp-block-paragraph">Ansible architecture components:</p>



<p class="wp-block-paragraph">1.User &#8212;&gt;Admin</p>



<p class="wp-block-paragraph">2. ACS &#8212;&gt; Ansible control server&#8212;&gt; management node</p>



<p class="wp-block-paragraph">3. ARS &#8212;-&gt; Ansible Remote server (Host 1 ,2 &#8230;.n)</p>



<p class="wp-block-paragraph">It has 3 main components of ACS:</p>



<p class="wp-block-paragraph">1 . Ansible  &#8212;&gt; tool which should be installed on linux and has plugins , modules, executables, and config files embedded in it.</p>



<p class="wp-block-paragraph">2. Ansible Inventory &#8212;-&gt;  It contains a list of ip addresses of ARS(Ansible remote server)</p>



<p class="wp-block-paragraph">3. Ansible Playbook &#8212;> It is a script containing modules which runs on ARS</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe  id="_ytid_18166"  width="675" height="379"  data-origwidth="675" data-origheight="379" src="https://www.youtube.com/embed/LB9D-HDdAFg?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__  epyt-is-override  no-lazyload" title="YouTube player"  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></figure>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
