Skip to content

Instantly share code, notes, and snippets.

View mjinks's full-sized avatar

Michael Jinks mjinks

  • Chicago, Illinois, USA
View GitHub Profile
{# under my own state, 'vsftpd-users.indoor' #}
{% from "vsftpd/map.jinja" import vsftpd with context %}
{% from "users/map.jinja" import users with context %}
{% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
{% if 'ftpuser' in user %}
{{ name }}_vsftpd_user_export:
file.append:
- name: /root/ftp_user_list
@mjinks
mjinks / The minion sees nothing
Created May 13, 2016 20:14
How do I find my external pillar?
$ time sudo salt-call pillar.items
local:
----------
_errors:
- Specified SLS 'stack/first-try' in environment 'base' is not available on the salt master
One pillar already exists:
users:
bob:
home: /some/odd/place/bob
setting_foo: blah
setting_bar: 42
password: [hash]
another is input, where some elements are present:
i have:
users:
joe:
thing:
- foo
- bar
bob:
thing:
- baz
@mjinks
mjinks / hack i'm trying
Last active February 12, 2016 20:03
BIND: 'notify' item required, was: Jinja goose chase: "notify"
bind_local_config:
file.managed:
- name: {{ map.local_config }}
- source: 'salt://{{ map.config_source_dir }}/named.conf.local'
- template: jinja
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
- mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
- context:
map: {{ map }}
@mjinks
mjinks / ...but, even with those host salted in:
Last active February 4, 2016 21:39
ssh_known_hosts isn't behaving
$ ssh evil
The authenticity of host 'evil (192.168.50.39)' can't be established.
ECDSA key fingerprint is 36:e8:c5:97:ca:88:65:69:c2:f6:30:3d:b0:f3:1b:bc.
animate-dump-symlink:
file.symlink:
- name: /opt/animate/scripts/db-dump.sh
- target:
{% if grains['nodename'] == 'anistage-db01' %}
{% set target = '/opt/PRLSS/scripts/animate-mysql-dbms-dump.sh.2' %}
{% else %}
{% set target = '/opt/PRLSS/scripts/animate-mysql-dbms-dump.sh' %}
{% endif %}
- makedirs: True
@mjinks
mjinks / init.sls
Last active January 7, 2016 07:24
all i want to do is assign a string
config_my_site:
file.managed:
- name: /etc/apache2/sites-available/my-site-8181
- template: jinja
- source: salt://animate-web-2/templates/my-site-8181-virtual.tmpl
[ something else must go here ]
- watch_in:
- service: apache2
@mjinks
mjinks / have tried various things in the neighborhood of...
Created December 29, 2015 08:04
i just want to walk a damn list
{% for name in {{ pillar['damnjava']['apps'] }} %}
java_app_{{ name }}:
file.symlink:
- name: /etc/alternatives/{{ name }}
- target: /opt/software/java/bin/{{ name }}
{% endfor %}
@mjinks
mjinks / 1. What I think should work
Last active November 18, 2015 22:25
The goal: apply the bind formula, but: replace the 'query.log' state, and, have dev/qa/prod instances
Cribbing, I thought, from:
https://docs.saltstack.com/en/latest/topics/tutorials/states_pt4.html#salt-fileserver-path-inheritance
...and also,
[other page where (I thought) it describes d/q/p]
>>> In /etc/salt/master:
file_roots:
base:
- /srv/salt/prod