<?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>sanchita.narzary &#8211; Best DevOps</title>
	<atom:link href="https://www.bestdevops.com/author/sanchita-narzary/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>Tue, 07 Sep 2021 06:30:28 +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 Variable Lab &#038; Excercise – Part 2</title>
		<link>https://www.bestdevops.com/ansible-variable-lab-excercise-part-2-3/</link>
		
		<dc:creator><![CDATA[sanchita.narzary]]></dc:creator>
		<pubDate>Mon, 06 Sep 2021 11:00:42 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=21010</guid>

					<description><![CDATA[Assigment 1 – Create a playbook and setup a webserver(httpd) and use httpd as a variable decalared in role var [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><strong>Assigment 1 – Create a playbook and setup a webserver(httpd) and use httpd as a variable decalared in role var file</strong></p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">---
-name: webserver
 <span class="hljs-attr">host</span>:web
 <span class="hljs-attr">vars_files</span>:
   - <span class="hljs-keyword">var</span>-file.yml

 <span class="hljs-attr">tasks</span>:
 -name: Install latest httpd
  <span class="hljs-attr">yum</span>:
     name: <span class="hljs-string">"{{packname}}"</span>
     <span class="hljs-attr">state</span>: latest
 - name: Start service httpd, <span class="hljs-keyword">if</span> not started
   ansible.builtin.service:
      name: <span class="hljs-string">"{{packname}}"</span>
      <span class="hljs-attr">state</span>: started</code></span></pre>


<p class="wp-block-paragraph"><strong>Assigment 2 – Create a playbook and setup a webserver(httpd) and use httpd as a variable declared using prompt.</strong></p>


<pre class="wp-block-code"><span><code class="hljs language-php">---
-name: webserver
 host: web
 vars_prompt:
   - name: <span class="hljs-string">"webserver"</span>
      prompt: <span class="hljs-string">"Which webserver do you want to install?"</span>
      <span class="hljs-keyword">private</span>: <span class="hljs-keyword">false</span>
 tasks:
 - yum:
    name: <span class="hljs-string">"{{ webserver }}"</span>
    state: latest
 - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name: <span class="hljs-string">"{{ webserver }}"</span>
      state: started</code></span></pre>


<p class="wp-block-paragraph"><strong>Assigment 3 – Create a playbook and setup a webserver(httpd) and find a list of .txt file in some directory and output using register variables</strong></p>


<pre class="wp-block-code"><span><code class="hljs language-php">---
-name: webserver
 host:web
 vars:
   webserver: httpd

 tasks:
 -name: Install latest httpd
  yum:
    name: <span class="hljs-string">"{{ webserver }}"</span>
    state: latest
 - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name: <span class="hljs-string">"{{ webserver }}"</span>
      state: started
 -name: Listing .txt files
    shell: <span class="hljs-string">"find *.txt"</span>
    args:
      chdir: <span class="hljs-string">"/home/centos/ansible/sanchita"</span>
    register: find_output
 - name: <span class="hljs-keyword">Print</span> the vars
   ansible.builtin.debug:
     <span class="hljs-keyword">var</span>: find_output.stdout_lines
    </code></span></pre>


<p class="wp-block-paragraph"><strong>Assigment 4 – Create a playbook and setup a webserver(httpd), copy a index.html and interpolate variables in template file decalared in playbook.</strong></p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">---
-name: webserver
 <span class="hljs-attr">host</span>:web
 <span class="hljs-attr">vars</span>:
   webserver: httpd
 
 <span class="hljs-attr">tasks</span>:
 -name: Install latest httpd
  <span class="hljs-attr">yum</span>:
    name: <span class="hljs-string">"{{ webserver }}"</span>
    <span class="hljs-attr">state</span>: latest
 - name: copy index.html
   ansible.builtin.template:
     src: index.html.j2
     <span class="hljs-attr">dest</span>: <span class="hljs-regexp">/var/</span>www/html/
 - name: Start service httpd, <span class="hljs-keyword">if</span> not started
   ansible.builtin.service:
     name: <span class="hljs-string">"{{ webserver }}"</span>
     <span class="hljs-attr">state</span>: started</code></span></pre>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ansible Playbook Lab &#038; Excercise – Part 3</title>
		<link>https://www.bestdevops.com/ansible-playbook-lab-excercise-part-3/</link>
		
		<dc:creator><![CDATA[sanchita.narzary]]></dc:creator>
		<pubDate>Mon, 06 Sep 2021 10:41:28 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=20981</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[
<p class="wp-block-paragraph"><strong>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”<br>To be used Conditiong, looping, regiter and fact variable.</strong></p>


<pre class="wp-block-code"><span><code class="hljs language-php">---
- name: Assignment <span class="hljs-number">2</span>
  hosts: localhost
  vars:
    webserver: httpd

  tasks:
  - name: Install the latest version of webserver
    yum:
      name={{ webserver}}
      state=latest
    when: ansible_os_family == <span class="hljs-string">"RedHat"</span>
  - name: Install the latest version of webserver
    apt:
      name={{ webserver}}
      state=latest
    when: ansible_os_family == <span class="hljs-string">"Ubuntu"</span>
  - name: Install the latest version of webserver
    apt:
      name={{ webserver}}
      state=latest
    when: ansible_os_family == <span class="hljs-string">"Ubuntu"</span>
  - name: <span class="hljs-keyword">Return</span> motd to registered <span class="hljs-keyword">var</span>
    ansible.builtin.command: ls /etc
    register: find_output
  - debug:
      msg: <span class="hljs-string">"The list in directory /etc is"</span> {{ find_output.stdout_lines }}
</code></span></pre>


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


<p>#group_vars/dev<br />
port: 80</p>


<p>#group_vars/qa<br />
port: 8080</p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">---
- name: Template <span class="hljs-built_in">module</span> and zinza2 <span class="hljs-built_in">module</span>
  <span class="hljs-attr">hosts</span>: dev,qa

  <span class="hljs-attr">tasks</span>:
  - name: Install latest httpd
    <span class="hljs-attr">yum</span>:
      name: httpd
      <span class="hljs-attr">state</span>: latest
  - 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
  - debug: 
      msg: Port {{ port }}
  <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>


<p class="wp-block-paragraph"><strong>Write a 3 yaml playbook i.e main.yaml, second.yaml and third.yaml with some demo debug tasks and call second.yaml and third.yaml from main.yaml using include.</strong></p>


<pre class="wp-block-code"><span><code class="hljs language-css"># <span class="hljs-selector-tag">second</span><span class="hljs-selector-class">.yaml</span>
<span class="hljs-selector-tag">-</span> <span class="hljs-selector-tag">name</span>: <span class="hljs-selector-tag">Debug</span>
  <span class="hljs-selector-tag">debug</span>:
    <span class="hljs-selector-tag">msg</span>: <span class="hljs-selector-tag">In</span> <span class="hljs-selector-tag">second</span><span class="hljs-selector-class">.yaml</span></code></span></pre>

<pre class="wp-block-code"><span><code class="hljs language-css"># <span class="hljs-selector-tag">third</span><span class="hljs-selector-class">.yaml</span>
<span class="hljs-selector-tag">-</span> <span class="hljs-selector-tag">name</span>: <span class="hljs-selector-tag">Debug</span>
  <span class="hljs-selector-tag">debug</span>:
    <span class="hljs-selector-tag">msg</span>: <span class="hljs-selector-tag">In</span> <span class="hljs-selector-tag">third</span><span class="hljs-selector-class">.yaml</span></code></span></pre>

<pre class="wp-block-code"><span><code class="hljs language-css"><span class="hljs-selector-id">#main</span><span class="hljs-selector-class">.yaml</span>
<span class="hljs-selector-tag">-</span> <span class="hljs-selector-tag">hosts</span>: <span class="hljs-selector-tag">all</span>
  <span class="hljs-selector-tag">tasks</span>:
    <span class="hljs-selector-tag">-</span> <span class="hljs-selector-tag">debug</span>:
        <span class="hljs-selector-tag">msg</span>: <span class="hljs-selector-tag">task1</span>

<span class="hljs-selector-tag">-</span> <span class="hljs-selector-tag">include</span>: <span class="hljs-selector-tag">second</span><span class="hljs-selector-class">.yaml</span>
<span class="hljs-selector-tag">-</span> <span class="hljs-selector-tag">include</span>: <span class="hljs-selector-tag">third</span><span class="hljs-selector-class">.yaml</span></code></span></pre>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ansible Playbook Exercises</title>
		<link>https://www.bestdevops.com/ansible-playbook-lab-excercise/</link>
		
		<dc:creator><![CDATA[sanchita.narzary]]></dc:creator>
		<pubDate>Mon, 06 Sep 2021 05:35:49 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=20960</guid>

					<description><![CDATA[https://www.devopsschool.com/blog/ansible-playbook-lab-excercise-part-2/ To run the playbook: Playbook Variables Precedence of Variables Command Line variable takes precedence over all other. Variables using [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><a href="https://www.devopsschool.com/blog/ansible-playbook-lab-excercise-part-2/">https://www.devopsschool.com/blog/ansible-playbook-lab-excercise-part-2/</a></p>


<pre class="wp-block-code"><span><code class="hljs language-php"><span class="hljs-comment"># inventory</span>
&#91;web]
<span class="hljs-number">13.232</span><span class="hljs-number">.181</span><span class="hljs-number">.124</span>
<span class="hljs-number">35.154</span><span class="hljs-number">.128</span><span class="hljs-number">.2</span>

&#91;web:vars]
ansible_user=centos
ansible_ssh_private_key_file=node.pem
ansible_become=yes</code></span></pre>

<pre class="wp-block-code"><span><code class="hljs language-php"><span class="hljs-comment">#assignment.yaml</span>
- name: Playbook Assignment
  hosts: web

  tasks:
  - name: Create group called deploy
    group:
      name: Deploy
      state: present
  - name: Create user in group with bin bash shell
    user:
      name: deploy-user
      shell=/bin/bash
      state: present
  - name: Install the latest version of Apache
    yum:
      name: httpd
      state: latest
  - name: Create file second in <span class="hljs-keyword">var</span>/www/html
    file:
      path: /<span class="hljs-keyword">var</span>/www/html/second.html
      state: file
  - 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
  - name: Start service httpd, <span class="hljs-keyword">if</span> not started
    ansible.builtin.service:
      name: httpd
      state: started
  - name: Install the latest version of git <span class="hljs-keyword">and</span> wget
    yum:
      name: git
      state: latest
    yum:
      name: wget
      state: latest

- name: Playbook Assignment
  hosts: localhost

  tasks:
  - name: <span class="hljs-keyword">Clone</span> repository
    git:
      repo: <span class="hljs-string">'https://github.com/scmgalaxy/ansible-role-template
      dest = /home/centos/ansible/sanchita
      clone: yes
  - name: Start service httpd, if not started
    reboot:</span></code></span></pre>


<p class="wp-block-paragraph"><strong>To run the playbook:</strong></p>


<p>$ ansible-playbook -i inventory assignment.yaml</p>



<h2 class="wp-block-heading">Playbook Variables</h2>


<pre class="wp-block-code"><span><code class="hljs language-php"><span class="hljs-comment"># playbook-variables.yaml</span>
---
- name: Variable precedence
  hosts: localhost
  vars:
    myname: Sanchita
  vars_prompt:
    - name: <span class="hljs-string">"myname"</span>
      prompt: <span class="hljs-string">"What is your name?"</span>
      <span class="hljs-keyword">private</span>: <span class="hljs-keyword">false</span>
  vars_files:
    - ext-vars.yaml

  tasks:
  - name: <span class="hljs-keyword">Print</span> the vars
    ansible.builtin.debug:
      msg: My name {{ myname }}
  - 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>.yaml
  - name: <span class="hljs-keyword">Print</span> the vars
    ansible.builtin.debug:
      msg: My name {{ myname }}
  - name: Ansible register variable basic example
    shell: <span class="hljs-string">"find *.yaml"</span>
    args:
      chdir: <span class="hljs-string">"/home/centos/ansible/sanchita"</span>
    register: find_output
  - debug:
      <span class="hljs-keyword">var</span>: find_output.stdout_lines&#91;<span class="hljs-number">0</span>]
  - name: <span class="hljs-keyword">Print</span> the vars
    ansible.builtin.debug:
      msg: My name is  {{ myname }}
</code></span></pre>


<h2 class="wp-block-heading">Precedence of Variables</h2>



<ul class="wp-block-list"><li>Command Line variable takes precedence over all other.</li><li>Variables using task include takes precedence over all, except command line variable.</li><li>External variables take precedence over variable prompt.</li><li>Variable using prompt takes precedence over embedded variables.</li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ansible Adhoc Commands Lab and Excercise – Part 1</title>
		<link>https://www.bestdevops.com/ansible-assignment-lab-1/</link>
		
		<dc:creator><![CDATA[sanchita.narzary]]></dc:creator>
		<pubDate>Sat, 04 Sep 2021 07:31:50 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=20865</guid>

					<description><![CDATA[Write a Ansible Adhoc Commands to create a group called “deploy Write a Ansible Adhoc Commands to create a user [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><strong>Write a Ansible Adhoc Commands to create a group called “deploy</strong></h2>


<p>$ ansible localhost -m group -a&#8221;name=deploy state=present&#8221; -b </p>



<h2 class="wp-block-heading"><strong>Write a Ansible Adhoc Commands to create a user called “deploy-user” which is part of group called “deploy” and with /bin/bash shell.</strong></h2>


<p>$ ansible localhost -m user -a &#8220;name=deploy-user group=deploy shell=/bin/bash state=present&#8221; -b</p>



<h2 class="wp-block-heading"><strong> Write a Ansible Adhoc commands install package named “httpd” in RHEL/centos.</strong></h2>


<p> ansible localhost -m yum -a&#8221;state=present name=httpd&#8221; -b</p>



<h2 class="wp-block-heading"><strong>Write a Ansible Adhoc commands to start and enable the service named “httpd”</strong></h2>


<p>$ ansible localhost -m service -a&#8221;name=httpd state=started&#8221; -b</p>



<h2 class="wp-block-heading"><strong>Write a Ansible commands to copy a file called “second.html” in /var/www/html/second.html with some dummy html contents.</strong></h2>


<p>$ ansible localhost -m copy -a&#8221;dest=/var/www/html src=second.html&#8221; -b</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>What is Ansible and How it works?</title>
		<link>https://www.bestdevops.com/what-is-ansible-and-how-it-works-2/</link>
		
		<dc:creator><![CDATA[sanchita.narzary]]></dc:creator>
		<pubDate>Sat, 04 Sep 2021 06:09:22 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=20831</guid>

					<description><![CDATA[What is Ansible? Ansible is a cross-platform Configuration Management Tool for Server(s), which is primarily written using python. Benefits of [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><strong>What is Ansible?</strong></h2>



<p class="wp-block-paragraph">Ansible is a cross-platform Configuration Management Tool for Server(s), which is primarily written using python.</p>



<h2 class="wp-block-heading"><strong>Benefits of Ansible</strong></h2>



<p class="wp-block-paragraph">The benefits are as follows:</p>



<ul class="wp-block-list"><li>It is easy to learn, understand and use which makes it the choice for server config management</li><li>It is <strong>Idempotent</strong>, that is, <strong>there are no additional effect if it is called more than once with the same input parameters.</strong></li><li>It is <strong>Platform Independent.</strong></li><li>Ansible-Command prompt is <strong>free.</strong></li></ul>



<h2 class="wp-block-heading">Architecture of Ansible</h2>



<figure class="wp-block-image size-large"><img decoding="async" src="https://th.bing.com/th/id/R.5b60be8903746f13418bcd37aa18a406?rik=OJafocjjbkreJA&amp;riu=http%3a%2f%2facloudata.in%2fwp-content%2fuploads%2f2018%2f09%2fAnsible-Architecture.jpg&amp;ehk=ra%2fQ9ua9CPaqg5P4HPCeJ2bo6NvsEgjYujv8tP%2fWzy0%3d&amp;risl=&amp;pid=ImgRaw&amp;r=0" alt="" /><figcaption>The above image is a simple architecture of Ansible where the users interact with the ACS(Ansible Control Server) which in turn interacts with the ARS(Ansible Remote Server). In this architecture, there can be a number of Remote servers (windows, linux or any other) and a single ACS (Linux, 64 bit). The ACS uses SSH to interact with Linux ARSs and HTTP(winrm) to interact with Windows ARSs.</figcaption></figure>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
