Archive for the ‘Linux’ Category

Broken sudo?

If you somehow add a dodgy sudo rule you might end up breaking it completely… sudo su – >>> /etc/sudoers.d/new_sudo_rule: syntax error near line 1

Linux: Reclaim disk space used by “deleted” files

I had a misbehaving application consuming a large amount of space in /tmp. The files were visible in the /tmp volume itself but lsof allowed me to identify them. lsof -a +L1 -c s3fs /tmp COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME s3fs 59614 root 28u REG 253,3 584056832 0 22 /tmp/tmpfMIMLU4 […]

Offset cron jobs with Ansible

Sometimes I want to run the same cronjob on a few hosts but I might want to offset them slightly if I’m accessing any shared resources. Here’s an easy way to do that, for a small number of hosts, using Ansible… – name: Ensure cron exists cron: name: Test Job minute: “{{ play_hosts.index(inventory_hostname) }}-59/5” job: […]

ssh-copy-id automation with a list of hosts

Here’s another version of my ssh-copy-id script this time using a text file containing a list of hosts. The hosts file should contain a single host per line. #!/bin/bash export SSH_USER=”user” read -s PASSWORD export PASSWORD while read HOST; do export HOST; expect -c ‘ set SSH_USER $env(SSH_USER) set HOST $env(HOST) set PASSWORD $env(PASSWORD) spawn […]

Creating a Vagrant, Virtualbox & Ansible environment in the Windows Linux Subsystem

I’ve just been given a new Windows corporate laptop, with a huge amount of RAM (64GB), a large number of cores, and I wanted to start using this as my main development virtualisation platform. I do a lot of stuff with Vagrant, Ansible and VirtualBox and Windows hasn’t always been a welcome home for this […]