<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:foaf="https://xmlns.com/foaf/0.1/" xmlns:og="https://ogp.me/ns#" xmlns:rdfs="https://www.w3.org/2000/01/rdf-schema#" xmlns:schema="https://schema.org/" xmlns:sioc="https://rdfs.org/sioc/ns#" xmlns:sioct="https://rdfs.org/sioc/types#" xmlns:skos="https://www.w3.org/2004/02/skos/core#" xmlns:xsd="https://www.w3.org/2001/XMLSchema#" version="2.0" xml:base="https://www.linuxjournal.com/tag/how">
  <channel>
    <title>HOW-To</title>
    <link>https://www.linuxjournal.com/tag/how</link>
    <description/>
    <language>en</language>
    
    <item>
  <title>Ansible, Part III: Playbooks</title>
  <link>https://www.linuxjournal.com/content/ansible-part-iii-playbooks</link>
  <description>  &lt;div data-history-node-id="1339671" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/Ansible_logo.svg__3.png" width="488" height="600" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/shawn-powers" lang="" about="https://www.linuxjournal.com/users/shawn-powers" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Shawn Powers&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;&lt;em&gt;Playbooks make Ansible even more powerful than before.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;
To be quite honest, if Ansible had nothing but its ad-hoc mode, it
still would be a powerful and useful tool for automating large numbers of
computers. In fact, if it weren't for a few features, I might consider
sticking with ad-hoc mode and adding a bunch of those ad-hoc commands to
a Bash script and be done with learning. Those few additional features,
however, make the continued effort well worth it.
&lt;/p&gt;

&lt;h3&gt;
Tame the Beast with YAML&lt;/h3&gt;

&lt;p&gt;
Ansible goes out of its way to use an easy-to-read configuration file for
making "playbooks", which are files full of separate Ansible
"tasks". A
task is basically an ad-hoc command written out in a configuration file
that makes it more organized and easy to expand. The configuration
files use YAML, which stands for "Yet Another Markup Language".
It's an easy-to-read markup language, but it does rely on whitespace,
which isn't terribly common with most config files. A simple playbook
looks something like this:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
---

- hosts: webservers
  become: yes
  tasks:
    - name: this installs a package
      apt: name=apache2 update_cache=yes state=latest

    - name: this restarts the apache service
      service: name=apache2 enabled=yes state=restarted
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
The contents should be fairly easy to identify. It's basically two
ad-hoc commands broken up into a YAML configuration file. There are a
few important things to notice. First, every filename ends with .yaml,
and every YAML file must begin with three hyphen characters. Also, as
mentioned above, whitespace matters. Finally, when a hyphen should
precede a section and when it should just be spaced appropriately often
is confusing. Basically every new section needs to start with a - symbol,
but it's often hard to tell what should be its own section. Nevertheless,
it starts to feel natural as you create more and more playbooks.
&lt;/p&gt;

&lt;p&gt;
The above playbook would be executed by typing:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
ansible-playbook filename.yaml
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
And that is the equivalent of these two commands:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
ansible webservers -b -m apt -a "name=apache2
 ↪update_cache=yes state=latest"
ansible webservers -b -m service -a "name=apache2
 ↪enabled=yes state=restarted"
&lt;/code&gt;
&lt;/pre&gt;


&lt;h3&gt;
Handling Your Handlers&lt;/h3&gt;

&lt;p&gt;
But a bit of organization is really only the beginning of why playbooks
are so powerful. First off, there's the idea of "Handlers", which are
tasks that are executed only when "notified" that a task has made a
change. How does that work exactly? Let's rewrite the above YAML file
to make the second task a handler:

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/ansible-part-iii-playbooks" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Mon, 19 Feb 2018 16:50:14 +0000</pubDate>
    <dc:creator>Shawn Powers</dc:creator>
    <guid isPermaLink="false">1339671 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>Getting Help From Linux - Part 2 Info</title>
  <link>https://www.linuxjournal.com/content/getting-help-linux-part-2-info</link>
  <description>  &lt;div data-history-node-id="1025338" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/Book_0.png" width="200" height="158" alt="book" title="Book" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/jayson-broughton" lang="" about="https://www.linuxjournal.com/users/jayson-broughton" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Jayson Broughton&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;Well here we are again, at part two of the 'Getting Help from Linux' series.  In this blog post I'll be talking about using Info to get help from Linux.  In &lt;a href="https://www.linuxjournal.com/content/getting-help-linux-part-1-man-pages"&gt;my previous post&lt;/a&gt; I spoke about how Info came about, but just in case you missed it I'll give you another quick lesson.  Gnu Info was created by the Free Software Foundation and in my experience is used by all of Gnu's software for their version of 'man' pages.  Info may contain much more information than what you can find in Man pages, and sometimes contains much more than you ever really need.  The good thing about Info is that it is a hypertext markup utility.  This makes it much easier to navigate through via hyperlinks embedded in emacs, than simply using arrow keys to navigate through information.  While Man uses the Less utility to control the display, the info utility itself is designed to display Info pages.  For those of you familiar with emacs, it appears the layout may be the same, along with some of the basic navigation. But that's where the two applications can differ.  If you're using the Info application then your commands will be different than if you're viewing info files in Emacs.  This article is about reading Info pages inside of info.&lt;/p&gt;
&lt;h3&gt;Layout and Navigation&lt;/h3&gt;
&lt;p&gt;Okay, I won't lie, navigation in emacs makes my head spin.  For some people this may come naturally, for those of us that have lived on vi all their lives the old adage 'you can't teach an old dog new tricks' really hits home when it comes to figuring out all of the emacs tips and tricks.  If anyone has actually gone through gnu.org's website on the Texinfo manual you know what I'm talking about.  The document on how to use Texinfo is 36 pages long, quite a bit longer than navigating Man pages in Less.   As far as layout goes, sections are broken down into what Info considers 'nodes', so if you see the reference to nodes in here then that's what I'm talking about.  As stated earlier, the info documents are written in hypertext, which makes it easier to navigate through than Man pages.  When you first execute 'info &lt;name&gt;' you are presented with the index for the subject that you are looking for.  Now before you start hyperventilating, think of the Info layout as a Tree (Top Node) with various branches spanning from the tree (Individual Nodes). The Branches just point back to the main 'branch'.&lt;/p&gt;
&lt;p&gt;Before I get ahead of myself, let me first explain the main window.&lt;/p&gt;
&lt;p&gt;At the bottom of your window is what is called the Mode Line.  The mode line just describes what you are viewing above, including information about the file, the node, number of lines, compression information, etc.  Here are some examples and explanations of Mode Lines:&lt;/p&gt;
&lt;p&gt;&lt;em&gt; zz-Info: (festival.info.gz)Top, 58 lines --Top-- Subfile:&lt;br /&gt;festival.info-1.gz-&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/getting-help-linux-part-2-info" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Tue, 11 Oct 2011 14:45:23 +0000</pubDate>
    <dc:creator>Jayson Broughton</dc:creator>
    <guid isPermaLink="false">1025338 at https://www.linuxjournal.com</guid>
    </item>

  </channel>
</rss>
