Skip to content

Instantly share code, notes, and snippets.

@asjalik
Created January 21, 2016 08:24
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 asjalik/7a057bada764e507772d to your computer and use it in GitHub Desktop.
Save asjalik/7a057bada764e507772d to your computer and use it in GitHub Desktop.
random
#checking dir and appending text to the bottom of file
#/srv/salt/random/init.sls
{% if not salt['file.directory_exists' ]('/home/init_dir') %}
/tmp/random:
file.directory:
- user: root
- name: /tmp/random
- group: root
- mode: 755
{% else %}
cmd.run:
- name: echo "Directory exists"
{% endif %}
/tmp/random/randomfile.txt:
file.append:
- text:
- "{{salt['pillar.get']('headers:salt:file')}}"
#pillars text
#/srv/pillar/headers/init.sls
headers:
salt:
file: |
# THIS FILE IS MANAGED BY SALTSTACK #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment