Bladeren bron

Added support for managing files by pillar

Change-Id: Ibd0a024bcd69089d9835a18f2bb803c952e13967
pull/139/head
Richard Felkl 7 jaren geleden
bovenliggende
commit
2e07d650c1
3 gewijzigde bestanden met toevoegingen van 72 en 0 verwijderingen
  1. +35
    -0
      README.rst
  2. +34
    -0
      linux/system/file.sls
  3. +3
    -0
      linux/system/init.sls

+ 35
- 0
README.rst Bestand weergeven

@@ -341,6 +341,41 @@ Ensure presence of directory:
mode: 700
makedirs: true

Ensure presence of file by specifying it's source:

.. code-block:: yaml

linux:
system:
file:
/tmp/test.txt:
source: http://example.com/test.txt
user: root
group: root
file_mode: 700
dir_mode: 700
encoding: utf-8
hash: <<md5 hash>>
makedirs: true

Ensure presence of file by specifying it's contents:

.. code-block:: yaml

linux:
system:
file:
/tmp/test.txt:
contents: |
line1
line2
user: root
group: root
file_mode: 700
dir_mode: 700
encoding: utf-8
hash: <<md5 hash>>
makedirs: true
Kernel
~~~~~~


+ 34
- 0
linux/system/file.sls Bestand weergeven

@@ -0,0 +1,34 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %}

{%- for file_name, file in system.file.iteritems() %}

{{ file_name }}:
file.managed:
{%- if file.source is defined %}
- source: {{ file.source }}
{%- endif %}
{%- if file.contents is defined %}
- contents: {{ file.contents }}
{%- endif %}
- makedirs: {{ file.get('makedirs', 'True') }}
- user: {{ file.get('user', 'root') }}
- group: {{ file.get('group', 'root') }}
{%- if file.file_mode is defined %}
- file_mode: {{ file.file_mode }}
{%- endif %}
{%- if file.dir_mode is defined %}
- dir_mode: {{ file.dir_mode }}
{%- endif %}
{%- if file.encoding is defined %}
- encoding: {{ file.encoding }}
{%- endif %}
{%- if file.hash is defined %}
- source_hash: {{ file.hash }}
{%- else %}
- skip_verify: True
{%- endif %}

{%- endfor %}

{%- endif %}

+ 3
- 0
linux/system/init.sls Bestand weergeven

@@ -102,6 +102,9 @@ include:
{%- if system.directory is defined %}
- linux.system.directory
{%- endif %}
{%- if system.file is defined %}
- linux.system.file
{%- endif %}
{%- if system.ld is defined %}
- linux.system.ld
{%- endif %}

Laden…
Annuleren
Opslaan