debian ansible playbook #5

This commit is contained in:
CaptainArk 2016-01-31 15:44:13 +01:00
parent fc44b69af3
commit a65064d250

View File

@ -9,7 +9,7 @@
<meta name="author" content="">
<title>Update Debian with Ansible</title>
<title>Debian updates with Ansible</title>
<!-- Bootstrap Core CSS -->
@ -44,8 +44,8 @@
<meta property="og:type" content="article">
<meta property="article:author" content="">
<meta property="og:url" content="https://captainark.net/update-debian-with-ansible.html">
<meta property="og:title" content="Update Debian with Ansible">
<meta property="og:url" content="https://captainark.net/debian-updates-with-ansible.html">
<meta property="og:title" content="Debian updates with Ansible">
<meta property="og:description" content="">
<meta property="og:image" content="https://captainark.net/">
<meta property="article:published_time" content="2016-01-31 00:00:00+01:00">
@ -88,7 +88,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>Update Debian with Ansible</h1>
<h1>Debian updates with Ansible</h1>
<span class="meta">Posted by
<a href="https://captainark.net/author/antoine-joubert.html">Antoine Joubert</a>
on Sun 31 January 2016
@ -109,7 +109,7 @@
<h2>Introduction</h2>
<p>I've recently bought a <a href="http://www8.hp.com/us/en/products/proliant-servers/product-detail.html?oid=5379860">HP Proliant Microserver Gen8</a> to play around with LXC and try new stuff.</p>
<p>From the 4 Debian machines I had to keep up-to-date, I now have 7, so it became quite time-consumming to manually SSH to each of them whenever an update became available.</p>
<p>I ended up looking at <a href="http://www.ansible.com/">Ansible</a> to speed up the process and, within an hour, I had a working playbook that updates the debian packages, pip packages and git repos on all of my servers with a single command.</p>
<p>I ended up looking at <a href="http://www.ansible.com/">Ansible</a> to speed up the process and, within an hour, I had a working playbook that updates the debian packages, pip packages and git repos installed on all of my servers with a single command.</p>
<p>I figured I'd share the playbook I use to update the Debian packages !</p>
<h2>The playbook</h2>
<p>I modified <a href="https://gist.github.com/maethor/380676f6b1cec8cc7439">this gist</a> to only use apt-get instead of both apt-get and aptitude.</p>
@ -129,6 +129,7 @@
<span class="l l-Scalar l-Scalar-Plain">when</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">(updates.stdout_lines)</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">name</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">upgrade packages</span>
<span class="l l-Scalar l-Scalar-Plain">apt</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">upgrade=dist</span>
<span class="l l-Scalar l-Scalar-Plain">when</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">(updates.stdout_lines)</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">name</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">check what the new version is</span>
<span class="l l-Scalar l-Scalar-Plain">shell</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">lsb_release -r | awk &#39;{print $2}&#39;</span>
<span class="l l-Scalar l-Scalar-Plain">changed_when</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">False</span>
@ -165,8 +166,8 @@
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'captainark';
var disqus_identifier = 'update-debian-with-ansible.html';
var disqus_url = 'https://captainark.net/update-debian-with-ansible.html';
var disqus_identifier = 'debian-updates-with-ansible.html';
var disqus_url = 'https://captainark.net/debian-updates-with-ansible.html';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//captainark.disqus.com/embed.js';