Reflinks for XFS are available in Fedora 27, so you no longer need to pull and compile xfsprogs from git. To leverage reflinks in XFS, you need to create a file system with the reflink=1 flag. [[email protected] mnt]# mkfs.xfs -m reflink=1 filesystem In my example I just created a file and mounted it on a loop device. [[email protected] mnt]# mkfs.xfs -m reflink=1 test.img Then I’ll mount it [[email protected] mnt]# mount -o loop test.

Continue reading

Directory Server using Go

I’ve been spending time learning Go and here’s a small utility I wrote that’s similar to Python’s SimpleHTTPServer. This utility just creates a small HTTP server serving the directory you define: package main import ( "log" "net/http" "os" ) func main() { if len(os.Args) < 2 { log.Fatal("You must enter a path") } path := os.Args[1] http.Handle("/", http.FileServer(http.Dir(path))) http.ListenAndServe(":8000", nil) } Then just do: go build main.go ./serve /etc

Continue reading

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.

Continue reading

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.

Continue reading

At home I use Ubiquiti gear for all of my networking and I use Cloudflare for my external DNS. Rather than use another service like DynDNS or No-IP, I set up a small script that runs on my EdgeRouter Lite that updates records for my stuff at home in a simple cron job. The script just uses Cloudflare’s API to update an existing record. I haven’t found a way to get the record name from the web interface yet so you do need to get the record ID from the API.

Continue reading

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’s a way to minimize the need for them in the tasks themselves. Let’s take Apache for example: - name: install apache package: name: httpd state: installed when: ansible_distribution == 'CentOS' - name: install apache package: name: apache2 state: installed when: ansible_distribution == 'Ubuntu' This can become annoying and hard to read when it’s all in one file.

Continue reading

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.

Continue reading

Author's picture

John Hooks

I do stuff with Linux.

Sr. System Engineer

Pittsburgh