Skip to content

Instantly share code, notes, and snippets.

View ryan-lane's full-sized avatar

Ryan Lane ryan-lane

  • PayPay Japan
  • San Francisco
View GitHub Profile
Comment: An exception occurred in this state: Traceback (most recent call last):
File "venv/src/salt/salt/state.py", line 1563, in call
**cdata['kwargs'])
File "mymodules/states/boto_dynamodb.py", line 371, in present
s3_base_location=config['s3_base_location'],
File "mymodules/states/boto_dynamodb.py", line 462, in _ensure_backup_datapipeline_present
return __states__['boto_datapipeline.present'](**kwargs)
File "venv/src/salt/salt/utils/lazy.py", line 87, in __getitem__
return self._dict[key]
KeyError: 'boto_datapipeline.present'
@ryan-lane
ryan-lane / gist:f423b87c5dabcc24301d
Last active August 29, 2015 14:00
Salt states example
# Two inconsistent and unclear ways of defining a state:
pkg.installed:
- name: mypackage
apache2:
pkg
- installed
service:
- running
@ryan-lane
ryan-lane / gist:cabe233738028d3082dc
Created May 2, 2014 21:27
Launch config and autoscaling group state example need for a register action
Ensure my launch config exists:
boto_launch_config.present:
- name: my-launch-config-name
- ami: ami-887i9080
- instance_type: c3.2xlarge
- register: my_launch_config
Ensure my autoscale group exists:
boto_autoscale_group.present:
- name: my-autoscale-group-name
Ensure myelb exists:
boto_elb.present:
- name: myelb
- availability_zones:
- us-east-1a
- listeners:
- elb_port: 80
instance_port: 8210
elb_protocol: HTTP
- elb_port: 443
@ryan-lane
ryan-lane / gist:085ec4fd14f337a6b09f
Created June 10, 2014 16:49
Only run apt-get update if a ppa has changed
Run apt-get update on ppa additions:
module.wait:
- name: pkg.refresh_db
Ensure openstack ppa:
pkgrepo.managed:
- ppa: openstack-ubuntu-testing/juno
- refresh_db: False
- watch_in:
- module: pkg.refresh_db
{{ (grains['mem_total'] * 1024) * 0.1 | round(1, 'floor') | int }}
0
{{ (grains['mem_total'] * 1024) / 10 | round(1, 'floor') | int }}
383795.2
{{ ((grains['mem_total'] * 1024) * 0.1) | round(1, 'floor') | int }}
@ryan-lane
ryan-lane / execution module: testme.py
Last active August 29, 2015 14:02
Using __context__ in execution modules
def testme():
if not 'testme.testme' in __context__:
__context__['testme.testme'] = 1
else:
__context__['testme.testme'] = __context__['testme.testme'] + 1
return __context__['testme.testme']
### Apache
Ensure apache packages are installed:
pkg.installed:
- pkgs:
- apache2
- apache2-utils
- libapache2-mod-wsgi
Ensure apache is stopped on install:
cmd.wait:
KeyError: 'file_|-Ensure statsd supervisor configuration exists_|-/etc/supervisor/conf.d/statsd.conf_|-managed'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 128, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/__init__.py", line 398, in run
caller.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 186, in run
ret = self.call()
@ryan-lane
ryan-lane / Vagrantfile
Created July 11, 2014 00:18
Salt development Vagrantfile
$script = <<SCRIPT
# Install salt dependencies
sudo apt-get -y update
sudo apt-get install -y build-essential libssl-dev python-dev python-m2crypto \
python-pip python-virtualenv python-zmq swig virtualenvwrapper git-core python-apt
if [ ! -d /srv/salt/venv ]
then
sudo mkdir -p /srv/salt/venv
fi