SaltStack Ubuntu Hostname

SaltStack currently doesn’t set the hostname correctly on Debian/Ubuntu. For example, this won’t work:

system:
    network.system:
      - enabled: True
      - hostname: server1.example.com

Here’s a little shell script I wrote, to get around this problem:

% cat set_hostname.sh 
#!/bin/bash

hn=$1
hostname $hn
echo $hn > /etc/hostname
sed -i "1s/.*/127.0.0.1 localhost $hn/" /etc/hosts

Then apply it using cmd.script, for example:

foo-hostname:
  cmd.script:
    - source: salt://soe/set_hostname.sh
    - args: foo.bar.com
    - unless: grep -q "foo.bar.com" /etc/hosts


Terraform Presentation

Here are the slides from my Terrraform presentation at the Sydney Puppet Meetup. more…

Building the development version of Terraform

Instructions on how to build the development version of Terraform. First you need to install Go, I have a script for this that would be easy to adapt for your needs. It installs Go, but also downloads some common projects (go-bindata, lint) and my own […] more…

Git and mercurial abort: revision cannot be pushed

I’ve been migrating some repositories from Mercurial to Git; as part of this migration process some users want to keep using Mercurial locally until they have time to learn git. First install the hg-git tools; for example on Ubuntu: Make sure the following is in […] more…

SaltStack Essential Reading

A list of ‘Essential Reading’ for SaltStack. A collection of useful links, mostly for myself but possibly helpful to others. How Do I Use Salt States,  States tutorial and Pillar Walkthrough – the tutorials Highstate data structure definitions and  Understanding YAML – helpful for understanding […] more…

Setup Arduino on Debian

Some notes on setting up Arduino on Debian. Add yourself to the required groups – dialout and tty. Confirm the port /dev/ttyUSB0 is being used by Arduino – tail messages then plug in the Arduino. Logout and login (or run a login shell). Confirm permissions. […] more…

Split() function for Microsoft MSSQL

Microsoft MSSQL doesn’t have a split() function (like in Ruby, Perl), so here’s one I wrote. It’s different from the other MSSQL split() functions out there on the intertubes in that it accepts a @pos parameter that specifies which split item to return – easier […] more…

Next Page »