<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>ansible on John Hooks</title>
    <link>https://badlyenginee.red/tags/ansible/</link>
    <description>Recent content in ansible on John Hooks</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sat, 01 Feb 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://badlyenginee.red/tags/ansible/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Using Terraform and Ansible Together</title>
      <link>https://badlyenginee.red/posts/ansible-terraform/</link>
      <pubDate>Sat, 01 Feb 2020 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/ansible-terraform/</guid>
      <description>This should be a short one. So Ansible has dynamic inventories however I&amp;rsquo;ve found it a bit slow with VMware if you have a lot of infrastructure to parse through (a lot being around 3,000 VMs in your vCenter and slow being around 15 minutes). I also couldn&amp;rsquo;t figure out a way to use tags to limit what you&amp;rsquo;re searching on. This admittedly could have changed recently but since I&amp;rsquo;ve been using this method I haven&amp;rsquo;t tried too hard to find out.</description>
    </item>
    
    <item>
      <title>Using Make for SysAdmin Tasks</title>
      <link>https://badlyenginee.red/posts/2019-08-11-sysadmin-make/</link>
      <pubDate>Sun, 11 Aug 2019 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/2019-08-11-sysadmin-make/</guid>
      <description>When most people hear about make they think of compiling source code. While that is often what it&amp;rsquo;s used for, there are other good uses as well. Here&amp;rsquo;s an example of using it with Terraform/Ansible to build your infrastructure. Make has some advantages over just using a shell script. One is the native concept of dependencies. You can easily define which targets are dependencies of other targets. Make also has some idempotence baked in (as long as everything isn&amp;rsquo;t a phony target).</description>
    </item>
    
    <item>
      <title>Ansible Modules with Go</title>
      <link>https://badlyenginee.red/posts/2019-06-30-ansible-modules-go/</link>
      <pubDate>Sun, 30 Jun 2019 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/2019-06-30-ansible-modules-go/</guid>
      <description>Since Ansible 2.2 you can use binary applications as modules for Ansible. This means you can write modules in languages other than Python. The downside is that the modules aren&amp;rsquo;t integrated as well as if they were written in Python with Ansiballz. The binary modules only takes the filename as an argument which is a temporary file containing the JSON data of the modules parameters.
I took the boilerplate code that Ansible had here and created a small module to generate a random password.</description>
    </item>
    
    <item>
      <title>Ansible and Jenkins Remote Triggers</title>
      <link>https://badlyenginee.red/posts/2019-06-18-jenkins-remote-trigger/</link>
      <pubDate>Tue, 18 Jun 2019 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/2019-06-18-jenkins-remote-trigger/</guid>
      <description>Ansible Tower has an awesome feature that I&amp;rsquo;ve talked about before called provisioning callbacks. It&amp;rsquo;s hard to beat their simplicity, one click of a button and you have an API endpoint and a key to use. However you can replicate this in Jenkins with just about the same amount of work. Coming from using both Tower and Jenkins, I currently prefer to use Jenkins. I find it a little more flexible.</description>
    </item>
    
    <item>
      <title>Transient Playbooks for Ansible</title>
      <link>https://badlyenginee.red/posts/2019-06-17-ansible-dynamic/</link>
      <pubDate>Mon, 17 Jun 2019 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/2019-06-17-ansible-dynamic/</guid>
      <description>So I had a unique scenario where we built a solution for users using Ansible but wanted to make it simple so that it didn&amp;rsquo;t require the end users to understand how to build an inventory or playbooks.
So the solution we came up with was to build Ansible playbooks and inventories with Ansible itself. The users just need a single YAML file and then run a make command and Ansible builds itself the inventory, playbooks, and group_vars at run time.</description>
    </item>
    
    <item>
      <title>Create VMs on KVM with Ansible</title>
      <link>https://badlyenginee.red/posts/2017-10-04-create-vms-on-kvm-with-ansible/</link>
      <pubDate>Wed, 04 Oct 2017 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/2017-10-04-create-vms-on-kvm-with-ansible/</guid>
      <description>So the Ansible virt module doesn’t have a clone option and the creation of guests is a little limited. Because of this we have to use the shell or command modules and try to make them idempotent. This is a simple example and the dictionary can be expanded to a lot more customization. There is a way to use libvirt as a dynamic inventory and set group and host vars on guests, but I’ll cover that in a different post.</description>
    </item>
    
    <item>
      <title>Automated Ansible Testing with Molecule</title>
      <link>https://badlyenginee.red/posts/2017-09-30-automated-ansible-testing-with-molecule/</link>
      <pubDate>Sat, 30 Sep 2017 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/2017-09-30-automated-ansible-testing-with-molecule/</guid>
      <description>Infrastructure testing provides some challenges just because of the mere fact you are building machines and not just compiling code. To test Ansible, I used to run Ansible with --syntax-check and --list-tasks. For roles I would run local tests with Vagrant using the tests/ directory in the role. The tests had Ansible test itself with the uri module or other checks. This is ok for simple checks but can be cumbersome and time consuming as it doesn’t catch everything.</description>
    </item>
    
    <item>
      <title>Minimizing Conditionals in Ansible</title>
      <link>https://badlyenginee.red/posts/2017-08-25-minimizing-conditionals-in-ansible/</link>
      <pubDate>Fri, 25 Aug 2017 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/2017-08-25-minimizing-conditionals-in-ansible/</guid>
      <description>Ansible gives you conditionals to use when you want to check if something meets a certain criteria. However conditionals can become annoying if you need many include statements or repeat tasks based on facts. Here&amp;rsquo;s a way to minimize the need for them in the tasks themselves.
Let&amp;rsquo;s take Apache for example:
- name: install apache package: name: httpd state: installed when: ansible_distribution == &amp;#39;CentOS&amp;#39; - name: install apache package: name: apache2 state: installed when: ansible_distribution == &amp;#39;Ubuntu&amp;#39; This can become annoying and hard to read when it&amp;rsquo;s all in one file.</description>
    </item>
    
    <item>
      <title>Ansible Tower Provisioning Callbacks</title>
      <link>https://badlyenginee.red/posts/2017-08-23-ansible-tower-provisioning-callbacks/</link>
      <pubDate>Wed, 23 Aug 2017 00:00:00 +0000</pubDate>
      
      <guid>https://badlyenginee.red/posts/2017-08-23-ansible-tower-provisioning-callbacks/</guid>
      <description>One of Tower’s big selling points is the RESTful API. This allows systems to request certain templates to run against themselves from Tower. I leverage this on workstations with a systemd service and timer. Each workstation waits a predetermined time after boot and then does an API call to Tower. Tower then runs the workstation provision template against the system that requested it.
To enable callbacks, just check “Allow Provisioning Callbacks.</description>
    </item>
    
  </channel>
</rss>
