Skip to content

Instantly share code, notes, and snippets.

@quantonganh
quantonganh / salt-cmd.run
Last active December 30, 2015 02:59
Salt - cmd.run loop
ulimit/absent.sls
```
{% for file in salt['cmd.run']('ls /Users/quanta/salt.ulimit*') %}
{{ file }}:
file:
- absent
{% endfor %}
```
salt '*' cmd.run 'ls /Users/quanta/salt.ulimit*'
MacBook-Pro.local:
include:
- pyopenssl
tls:
module:
- run
- name: tls.create_self_signed_cert
- C: VN
- ST: HN
- L: Hanoi
MacBook-Pro.local:
----------
State: - module
Name: pip.install
Function: run
Result: True
Comment: Module function pip.install executed
Changes: ret: { pid : 68576
retcode : 0
stderr :
pyopenssl:
module:
- run
- name: pip.install
- pkgs: pyOpenSSL
- bin_env: /usr/local/bin/pip
MacBook-Pro.local:
----------
State: - module
Name: pip.install
Function: run
Result: True
Comment: Module function pip.install executed
Changes: ret: { pid : 68916
retcode : 0
stderr :
MacBook-Pro.local:
----------
State: - module
Name: pip.install
Function: run
Result: True
Comment: Module function pip.install executed
Changes: ret: { pid : 69136
retcode : 0
stderr :
{#-
Author: Quan Tong Anh <tonganhquan.net@gmail.com>
Maintainer: Quan Tong Anh <tonganhquan.net@gmail.com>
-#}
{% macro convert_hostname_to_ip(hostname) -%}
{% if salt['dig.A'](hostname) -%}
carbon = {{ salt['dig.A'](hostname)[0] }}:2003
{% else -%}
MacBook-Pro.local:
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb:853:in `expand_path': couldn't find HOME environment -- expanding `~/Library/Caches/Homebrew' (ArgumentError)
- from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb:853:in `expand_path'
- from /usr/local/Library/Homebrew/global.rb:25:in `cache'
- from /usr/local/Library/Homebrew/global.rb:44
- from /usr/local/Library/brew.rb:17:in `require'
- from /usr/local/Library/brew.rb:17
@quantonganh
quantonganh / salt '*' state.sls carbon
Created December 13, 2013 18:07
Salt - TypeError: argument of type 'StrictUndefined' is not iterable
Data failed to compile:
----------
Rendering SLS carbon failed, render error: Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/salt/utils/templates.py", line 79, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/usr/lib/pymodules/python2.7/salt/utils/templates.py", line 157, in render_jinja_tmpl
output = jinja_env.from_string(tmplstr).render(**unicode_context)
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "<template>", line 61, in top-level template code
include:
- graphite.common
- logrotate
- pip
- python.dev
/etc/logrotate.d/carbon:
file:
- managed
- template: jinja