Skip to content

Instantly share code, notes, and snippets.

@garthk
Created May 15, 2015 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garthk/75cf3c875bec91d8785a to your computer and use it in GitHub Desktop.
Save garthk/75cf3c875bec91d8785a to your computer and use it in GitHub Desktop.
SaltStack dev setup in Docker container

First:

docker pull ubuntu:trusty # for fresh copy
docker run -t -i ubuntu:trusty

Then, in, the container:

export ARCHIVE=archive.ubuntu.com
export ARCHIVE=mirror.internode.on.net/pub/ubuntu
cat > /etc/apt/sources.list <<EOF
deb http://${ARCHIVE}/ubuntu/ trusty main restricted
deb http://${ARCHIVE}/ubuntu/ trusty universe
deb http://${ARCHIVE}/ubuntu/ trusty-updates main restricted
deb http://${ARCHIVE}/ubuntu/ trusty-updates universe
deb http://${ARCHIVE}/ubuntu/ trusty-security main restricted
deb http://${ARCHIVE}/ubuntu/ trusty-security universe
deb http://ppa.launchpad.net/saltstack/salt/ubuntu trusty main
EOF
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E27C0A6

apt-get update && apt-get -y install \
    git-core \
    libffi-dev \
    libssl-dev \
    libzmq-dev \
    pkg-config \
    python-dev \
    python-m2crypto \
    python-virtualenv

git clone https://github.com/gladiatr72/salt.git -b tls_extension_work
cd salt
virtualenv --system-site-packages `pwd`
source bin/activate
pip install pyzmq PyYAML pycrypto msgpack-python jinja2 psutil tornado pyopenssl
python setup.py install

mkdir -p etc/salt etc/pki
echo master: `hostname` > etc/salt/minion
echo "ca.cert_base_path: 'etc/pki'" >> etc/salt/minion
echo root_dir: `pwd` > etc/salt/master

salt --versions-report
salt-master -c etc/salt -l info &

Wait until Worker binding to socket, then:

salt-minion -c etc/salt -l info &

Wait until The Salt Master has cached the public key for this node, then:

salt-key -c etc/salt -A -y
salt-call -c etc/salt test.ping

If you see local: True, you're up and running. Now try whatever commands you're debugging:

salt-call -c etc/salt -l debug tls.create_ca ca_name=demo CN=demo-ca days=3560
salt-call -c etc/salt -l debug tls.create_csr ca_name=demo CN=salt.example.com
salt-call -c etc/salt -l debug tls.create_ca_signed_cert ca_name=demo days=1825 CN=salt.example.com
@garthk
Copy link
Author

garthk commented May 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment