Posted on June 30, 2019, 4:26 pm, by Rhys, under
Ansible,
Linux.
I’ve been doing a lot in stuff in ansible recently where I needed to fire up, kill and relaunch a bunch of processes. I wanted to find a quick and reliable way of managing this… This is possible using a combination of the pids and wait_for modules… First get the pids of your process… – […]
Posted on June 15, 2019, 10:56 am, by Rhys, under
Linux.
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
Posted on May 13, 2019, 12:18 pm, by Rhys, under
Bash,
Linux.
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 […]
Posted on December 14, 2018, 1:26 pm, by Rhys, under
Ansible,
Linux.
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: […]
Posted on November 9, 2018, 1:21 pm, by Rhys, under
Bash,
Linux.
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 […]