Skip to content

Instantly share code, notes, and snippets.

jlund / gist:8698332
Created Jan 29, 2014
Ansible authorized_key module example
View gist:8698332
- name: Set up authorized_keys for the deploy user
authorized_key: user=deploy
key="{{ item }}"
- public_keys/lund-joshua
- public_keys/smith-john
jlund / roles--x--tasks--main.yml
Created Aug 7, 2013
Ansible: Using multiple arguments in with_items
View roles--x--tasks--main.yml
- name: Echo some things!
command: echo {{ }} {{ }}
with_items: echo_arguments
View main.yml
- name: Set the hostname in rc.conf
lineinfile: dest=/etc/rc.conf regexp="^hostname" line='hostname="{{ hostname }}"'
register: hostnamestatus
- name: Set the hostname
command: hostname {{ hostname }}
when: hostnamestatus.changed
jlund / ansible-codebase-checkout.yml
Last active Dec 18, 2015
Ansible codebase checkout
View ansible-codebase-checkout.yml
- name: Check out the latest revision of the codebase and notify the proper handlers if there have been updates
git: repo=
dest={{ imgur_display_location }}/current
sudo: yes
sudo_user: deploy
- Symlink the log directory to the shared location
- Install the bundle
- Restart the imgur-display application
jlund / salt-log-rotation.yml
Created Jun 11, 2013
Salt State to set up log rotation for Nginx and Passenger
View salt-log-rotation.yml
# Set up log rotation for Nginx and Passenger
{% for rotate_target in 'nginx', 'passenger' %}
/etc/logrotate.d/{{ rotate_target }}:
- source: salt://nginx-passenger/{{ rotate_target }}-logrotate
- require:
- cmd: nginx-install
- cmd: passenger
{% endfor %}
jlund / ansible-log-rotation.yml
Last active Apr 22, 2016
Ansible task to set up log rotation for Nginx and Passenger
View ansible-log-rotation.yml
- name: Set up log rotation for Nginx and Passenger
copy: src={{ item }}-logrotate
dest=/etc/logrotate.d/{{ item }}
- nginx
- passenger
jlund / salt-nginx-install.yml
Last active Dec 18, 2015
Fix for Passenger 4 installation issues in my salt-rack Salt States
View salt-nginx-install.yml
# Run the Nginx install script
- name: salt://nginx-passenger/
- unless: /opt/nginx/sbin/nginx -v 2>&1 | grep 1.4.1
- template: jinja
- require:
- file: nginx-source
- cmd: passenger
- file: /usr/local/bin/rake
jlund /
Created May 30, 2013
Python Salt state source compilation example
cd /usr/local/src/
tar xfj Python-3.3.2.tar.bz2
cd Python-3.3.2
./configure --prefix=/opt/python
make install