WIP3
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<section>
|
||||
<section data-state="title alt" id="RedIntro-TasksInAPlay">
|
||||
<h1>Tasks in a Play</h1>
|
||||
<img src="<?=$workshop_image?>" style="background-color: transparent; border: none;" height="250">
|
||||
<p>Tasks are the powerful pieces within a playbook that state paremeters and instruct the Ansible engine </p>
|
||||
<aside class="notes">
|
||||
</aside>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<section id="TaskModules">
|
||||
|
||||
<h2>Tasks</h2>
|
||||
<p>Tasks are the application of a module to perform a specific unit of work.</p>
|
||||
<ul>
|
||||
<li><b>file</b>: A directory should exist</li>
|
||||
<li><b>yum</b>: A package should be installed</li>
|
||||
<li><b>service</b>: A service should be running</li>
|
||||
<li><b>template</b>: Render a configuration file from a template</li>
|
||||
<li><b>get_url</b>: Fetch an archive file from a URL</li>
|
||||
<li><b>git</b>: Clone a source code repository</li>
|
||||
</ul>
|
||||
<aside class="notes">
|
||||
<p>We've already reviewed modules, the batteries and tools Ansible provides. Tasks are the specific application of a module to perform a unit of automation.</p>
|
||||
<p>Here we see a list of examples of common modules being applied to do something.</p>
|
||||
<aside>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<section id="TasksInAPlay">
|
||||
|
||||
<center><h2>EXAMPLE TASKS IN A PLAY</h2></center>
|
||||
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodylw">
|
||||
<font color="pink">---</font>
|
||||
tasks<font color="red">:</font>
|
||||
<font color="red">-</font> name<font color="red">:</font> Ensure httpd package is present
|
||||
yum<font color="red">:</font>
|
||||
name<font color="red">:</font> httpd
|
||||
state<font color="red">:</font> latest
|
||||
|
||||
<font color="red">-</font> name<font color="red">:</font> Ensure latest index.html file is present
|
||||
copy<font color="red">:</font>
|
||||
src<font color="red">:</font> files/index.html
|
||||
dest<font color="red">:</font> /var/www/html/
|
||||
|
||||
<font color="red">-</font> name<font color="red">:</font> Restart httpd
|
||||
service<font color="red">:</font>
|
||||
name<font color="red">:</font> httpd
|
||||
state<font color="red">:</font> restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<aside class="notes">
|
||||
<p>This example shows the task list of an Ansible playbook.</p>
|
||||
<p>
|
||||
<ol>
|
||||
<li>The first task assures the latest nginx package is installed using yum.</li>
|
||||
<li>The next uses the copy module to assure the latest version of a static home page file has been published.</li>
|
||||
<li>The last task restarts the nginx service with the service module</li>
|
||||
</ol>
|
||||
</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<section id="HandlerTasks">
|
||||
<h2>Handler Tasks</h2>
|
||||
<p>Handlers are special tasks that run at the end of a play if notified by another task when a change occurs.</p>
|
||||
<blockquote>If a package gets installed or updated, notify a service restart task that it needs to run.</blockquote>
|
||||
<aside class="notes">
|
||||
<p>Normal tasks run sequentially; handler tasks run on notification of a change and will only run once at the end of a play.</p>
|
||||
<p>For more information see <a href="http://docs.ansible.com/ansible/playbooks_intro.html#handlers-running-operations-on-change">Handler Tasks</a>.</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
<section data-transition="slide" id="Handler-Terminal">
|
||||
<h2>Example Handler Task in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
notify: httpd_running
|
||||
|
||||
- name: Verify correct config file is present
|
||||
copy:
|
||||
src: files/index.html
|
||||
dest: /var/www/html/index.html
|
||||
|
||||
handlers:
|
||||
|
||||
- name: httpd_running
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section data-transition="none" id="Handler-Mark-Notify">
|
||||
<h2>Example Handler Task in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
<mark> notify: httpd_running </mark>
|
||||
|
||||
- name: Verify correct config file is present
|
||||
copy:
|
||||
src: files/index.html
|
||||
dest: /var/www/html/index.html
|
||||
|
||||
handlers:
|
||||
|
||||
- name: httpd_running
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section data-transition="none" id="Handler-Mark-Handler">
|
||||
<h2>Example Handler Task in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
notify: httpd_running
|
||||
|
||||
- name: Verify correct config file is present
|
||||
copy:
|
||||
src: files/index.html
|
||||
dest: /var/www/html/index.html
|
||||
|
||||
<mark> handlers: </mark>
|
||||
|
||||
- name: httpd_running
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
<section data-transition="none" id="Handler-Mark-HandlerName">
|
||||
<h2>Example Handler Task in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
notify: httpd_running
|
||||
|
||||
- name: Verify correct config file is present
|
||||
copy:
|
||||
src: files/index.html
|
||||
dest: /var/www/html/index.html
|
||||
|
||||
handlers:
|
||||
|
||||
<mark> - name: httpd_running </mark>
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
<section data-transition="none" id="Handler-Mark-HandlerAndNotify">
|
||||
<h2>Example Handler Task in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
<mark> notify: httpd_running </mark>
|
||||
|
||||
- name: Verify correct config file is present
|
||||
copy:
|
||||
src: files/index.html
|
||||
dest: /var/www/html/index.html
|
||||
|
||||
<mark> handlers:
|
||||
|
||||
- name: httpd_running </mark>
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
<section data-transition="slide" id="Handlers-Terminal">
|
||||
<h2>Multiple Tasks Calling a Handler in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
notify: httpd_running
|
||||
|
||||
- name: Verify correct config file is present
|
||||
template:
|
||||
src: files/httpd.conf.j2
|
||||
dest: /etc/httpd/conf/httpd.conf
|
||||
notify: httpd_running
|
||||
|
||||
handlers:
|
||||
|
||||
- name: httpd_running
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section data-transition="none" id="Handlers-Mark-Notify">
|
||||
<h2>Multiple Tasks Calling a Handler in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
<mark> notify: httpd_running </mark>
|
||||
|
||||
- name: Verify correct config file is present
|
||||
template:
|
||||
src: files/httpd.conf.j2
|
||||
dest: /etc/httpd/conf/httpd.conf
|
||||
<mark> notify: httpd_running </mark>
|
||||
|
||||
handlers:
|
||||
|
||||
- name: httpd_running
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section data-transition="none" id="Handlers-Mark-Handler">
|
||||
<h2>Multiple Tasks Calling a Handler in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
notify: httpd_running
|
||||
|
||||
- name: Verify correct config file is present
|
||||
template:
|
||||
src: files/httpd.conf.j2
|
||||
dest: /etc/httpd/conf/httpd.conf
|
||||
notify: httpd_running
|
||||
|
||||
<mark> handlers:
|
||||
|
||||
- name: httpd_running </mark>
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
|
||||
<section data-transition="none" id="Handlers-Mark-HandlerAndNotify">
|
||||
<h2>Multiple Tasks Calling a Handler in a Play</h2>
|
||||
<div class="terminal space shadow">
|
||||
<div class="top">
|
||||
<div class="title">Ansible Terminal</div>
|
||||
</div>
|
||||
<pre class="bodymw">
|
||||
tasks:
|
||||
|
||||
- name: Ensure httpd package is present
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
<mark> notify: httpd_running </mark>
|
||||
|
||||
- name: Verify correct config file is present
|
||||
template:
|
||||
src: files/httpd.conf.j2
|
||||
dest: /etc/httpd/conf/httpd.conf
|
||||
<mark> notify: httpd_running </mark>
|
||||
|
||||
<mark> handlers:
|
||||
|
||||
- name: httpd_running </mark>
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<aside class="notes">
|
||||
<p>STUFF</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<section data-state="lab alt" id="<?=$labid?>-01">
|
||||
<h1><?=$pretty_htmldir?> LAB STUFF 01</h1>
|
||||
<img src="<?=$workshop_image?>" style="background-color: transparent; border: none;" height="250">
|
||||
<p>Let's do some stuff with tasks.</p>
|
||||
</section>
|
||||
<section data-state="lab alt" id="<?=$labid?>-02">
|
||||
<h1><?=$pretty_htmldir?> LAB STUFF 02</h1>
|
||||
<img src="<?=$workshop_image?>" style="background-color: transparent; border: none;" height="250">
|
||||
<p>Let's do some more stuff with tasks.</p>
|
||||
</section>
|
||||
Reference in New Issue
Block a user