<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ansible on dev.endevour</title><link>https://devendevour.iankulin.com/tags/ansible/</link><description>Recent content in Ansible on dev.endevour</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Sun, 03 Dec 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://devendevour.iankulin.com/tags/ansible/index.xml" rel="self" type="application/rss+xml"/><item><title>New Self-Hosted Service Workflow</title><link>https://devendevour.iankulin.com/new-self-hosted-service-workflow/</link><pubDate>Sun, 03 Dec 2023 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/new-self-hosted-service-workflow/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/es047_illustration_of_a_workflow_with_only_four_text_boxes_with_b026526e-30b7-45c7-9491-080adc1594ce.jpg" alt="" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve developed a bit of a workflow for setting up a new service of some type on the homelab. Installing it is the obvious thing, but I also have a few quality of life things I do to make it a full production-quality part of my installation. I thought it might be helpful to run through those things using a recent example of adding &lt;a href="https://www.audiobookshelf.org/" target="_blank" rel="noopener"&gt;audiobookshelf&lt;/a&gt; .&lt;/p&gt;
&lt;h3 id="audiobookshelf"&gt;audiobookshelf&lt;/h3&gt; &lt;p&gt;&lt;a href="https://www.audiobookshelf.org/" target="_blank" rel="noopener"&gt;audiobookshelf&lt;/a&gt; is a web based system for viewing, playing, downloading and/or generally managing your audio books. I&amp;rsquo;ve been an &lt;a href="https://www.audible.com.au/" target="_blank" rel="noopener"&gt;Audible&lt;/a&gt; user/subscriber, but recently got grumpy at them about something - I think I had paused my subscription, and my downloaded books were still available on my phone. I was halfway through one, upgraded the app, and then wasn&amp;rsquo;t able to play the book without re-subscribing. That might not be exactly right, but it was some type of frustrating carry on like that.&lt;/p&gt;</description></item><item><title>Ansible - Importing a Playbook</title><link>https://devendevour.iankulin.com/ansible-importing-a-playbook/</link><pubDate>Thu, 30 Nov 2023 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/ansible-importing-a-playbook/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/billyoblivion_intricate_and_highly_detailed_portable_ansible_la_c7e1c515-a2e6-4fef-b3c5-2d35e04ba09e.jpg" alt="" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="https://devendevour.iankulin.com/tags/ansible/"&gt;Ansible&lt;/a&gt; is a system for automating server tasks, and these tasks are written in a special yaml file called a playbook. I had need to call one playbook from another today and learned a couple of things.&lt;/p&gt;
&lt;h3 id="plays-vs-tasks"&gt;Plays vs Tasks&lt;/h3&gt; &lt;p&gt;In Ansible we run &lt;em&gt;tasks&lt;/em&gt;. A group of tasks run against one particular sets of hosts is called a &lt;em&gt;play&lt;/em&gt;. Here is a playbook with one play, and two tasks:&lt;/p&gt;</description></item><item><title>Ansible playbook to start Proxmox hosts</title><link>https://devendevour.iankulin.com/ansible-playbook-to-start-proxmox-hosts/</link><pubDate>Sun, 05 Nov 2023 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/ansible-playbook-to-start-proxmox-hosts/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/mick-jagger-start-me-up-video-the-rolling-stones-far-out-magazine-copy.jpg" alt="" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="https://devendevour.iankulin.com/proxmox-tags-to-solve-a-problem/"&gt;In my last post&lt;/a&gt; , I talked about tagging guests in a Proxmox node so I could easily see which VMs and LXCs I needed to manually start before I ran an Ansible script to run all my &lt;code&gt;apt updates&lt;/code&gt;. It would have been reasonable to wonder why I didn&amp;rsquo;t just add things to my playbook to magically do that.&lt;/p&gt;
&lt;p&gt;The answer would be, I haven&amp;rsquo;t gotten around to it yet, so here goes:&lt;/p&gt;</description></item><item><title>Caching APT updates</title><link>https://devendevour.iankulin.com/caching-apt-updates/</link><pubDate>Tue, 03 Oct 2023 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/caching-apt-updates/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/quangpham2576_realistic_red_hen_that_is_serving_a_plate_of_soft_b56bccf5-82c1-4bf9-9936-edd7606ab70a.jpg" alt="" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s bothered me for a while that all these VM&amp;rsquo;s are pulling down a lot of the same updates. As well as needlessly using some bandwidth, I&amp;rsquo;m hammering the update servers (that I don&amp;rsquo;t pay for) with the same requests over and over. I did briefly consider running my own mirror, but that&amp;rsquo;s not simple, plus I&amp;rsquo;d then be mirroring a heap of files in a complete repository that I&amp;rsquo;d never use. What I really needed was some sort of cache so once I&amp;rsquo;ll pulled down an update, it would hang around for a few days being available to other machines on the local network. Luckily, that exact thing exists - &lt;a href="https://www.unix-ag.uni-kl.de/~bloch/acng/html/index.html" target="_blank" rel="noopener"&gt;APT Cacher NG&lt;/a&gt; .&lt;/p&gt;</description></item><item><title>Installing service with Ansible</title><link>https://devendevour.iankulin.com/installing-service-with-ansible/</link><pubDate>Sat, 30 Sep 2023 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/installing-service-with-ansible/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/mlguy_synthetic_woman_is_installing_her_robotic_arm_ac961357-5997-4b2a-9b50-6f91ae9a4bf7.jpg" alt="" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;Having written my little monitoring endpoint in Go, it needs pushed out to all my servers and VM&amp;rsquo;s. Clearly this is a job for Ansible which I&amp;rsquo;ve already &lt;a href="https://devendevour.iankulin.com/ansible-with-secrets/"&gt;dabbled my toes in&lt;/a&gt; . Before we get onto doing that though, we need to have a think about how to make it a service.&lt;/p&gt;
&lt;h3 id="linux-services"&gt;Linux Services&lt;/h3&gt; &lt;p&gt;A service in Linux is just a program, but one that&amp;rsquo;s usually required to be running all the time to provide some piece of functionality. The &amp;ldquo;program&amp;rdquo; can be any executable, but to allow systemd to manage it, we need to tell it a bit about what we want in a &lt;code&gt;.service&lt;/code&gt; file. This file is used by &lt;code&gt;systemd&lt;/code&gt; to know how to manage the service. They can get quite complex, but here&amp;rsquo;s the simple one for &lt;code&gt;vitals-glimpse&lt;/code&gt; - my little monitoring API endpoint.&lt;/p&gt;</description></item><item><title>Ansible with Secrets</title><link>https://devendevour.iankulin.com/ansible-with-secrets/</link><pubDate>Sun, 13 Aug 2023 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/ansible-with-secrets/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/danbearpig_construction_process_photos_of_an_enormous_hyper-sec_4bbf6350-647d-4e32-971b-cd2041cb52a9_webp.jpg" alt="Two men standing in front of a giant vault door" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;We wrote a nice &lt;a href="https://devendevour.iankulin.com/first-ansible-playbook/"&gt;little Ansible playbook&lt;/a&gt; the other day to install nginx on our web servers and ensure it was running. We were able to store the usernames in the &lt;code&gt;hosts&lt;/code&gt; inventory file using the a&lt;code&gt;nsible_ssh_user&lt;/code&gt; variable. Then, we ran the playbook with the command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ansible-playbook web_installs.yaml --ask-become-pass&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This asked us the password to use with the usernames in the &lt;code&gt;hosts&lt;/code&gt; file. Luckily that day, it was the same username/password combo to use for sudo on every server. What happens if that&amp;rsquo;s not the case? Here&amp;rsquo;s our new hosts file for today. There&amp;rsquo;s a cool new sysadmin in town - Jane.&lt;/p&gt;</description></item><item><title>First Ansible Playbook</title><link>https://devendevour.iankulin.com/first-ansible-playbook/</link><pubDate>Wed, 26 Jul 2023 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/first-ansible-playbook/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/biomage_biomechanical_cyborg_computer_hacker_keyboard_protrudin_3d895c1b-0776-4f6e-b1a6-733b5622ea5d.jpg" alt="" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;In the &lt;a href="https://devendevour.iankulin.com/getting-started-with-ansible/"&gt;previous post&lt;/a&gt; , we looked at getting up and running with Ansible, including using the ad-hoc mode to send commands to our servers. We had a inventory file called hosts that had groups of server IP addresses and a simple &lt;code&gt;ansible.cfg&lt;/code&gt; file that pointed to our inventory file.&lt;/p&gt;
&lt;h3 id="playbooks"&gt;Playbooks&lt;/h3&gt; &lt;p&gt;Ansible playbooks are used to collect together a description of the state we want in a server. When the playbook is executed, Ansible figures out what things need need changed, and changes them. If you&amp;rsquo;re used to the procedural nature of a bash script, where things proceed from one step to the next, and there might be decision branches, this requires an adjustment in your thinking. This is similar to the adjustment I had getting my head around &lt;a href="https://betterprogramming.pub/swiftui-understanding-declarative-programming-aaf05b2383bd" target="_blank" rel="noopener"&gt;SwiftUI&lt;/a&gt; , and moving from JS to &lt;a href="https://levelup.gitconnected.com/why-react-is-declarative-a300d1e930b7?gi=3d11485226b4" target="_blank" rel="noopener"&gt;React&lt;/a&gt; .&lt;/p&gt;</description></item><item><title>Getting Started with Ansible</title><link>https://devendevour.iankulin.com/getting-started-with-ansible/</link><pubDate>Wed, 19 Jul 2023 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/getting-started-with-ansible/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/cyberpunk_24_k_hyper_realistic_a_thousand_details_hyper_detaile_841f4769-e869-497f-a804-c9fade21e150.jpg" alt="" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;Ansible is a system for executing commands on remote systems. It allows a declarative approach - so if you run a playbook (the system configuration files are called playbooks) that says a system has a Docker container running Jellyfin, Ansible will check if that&amp;rsquo;s true, and if not, make it so. Ansible is best used when you have a large number of systems to maintain, but even with a small number, it serves to document systems as well as to automate their creation.&lt;/p&gt;</description></item></channel></rss>