Change-Id: Ia286ac4377c6b03ce16c9dc1a5c7d3441efe7e12pull/144/head
file: | file: | ||||
/tmp/test.txt: | /tmp/test.txt: | ||||
source: http://example.com/test.txt | source: http://example.com/test.txt | ||||
user: root | |||||
group: root | |||||
mode: 700 | |||||
dir_mode: 700 | |||||
encoding: utf-8 | |||||
hash: <<md5 hash>> | |||||
makedirs: true | |||||
user: root #optional | |||||
group: root #optional | |||||
mode: 700 #optional | |||||
dir_mode: 700 #optional | |||||
encoding: utf-8 #optional | |||||
hash: <<hash>> or <<URI to hash>> #optional | |||||
makedirs: true #optional | |||||
linux: | |||||
system: | |||||
file: | |||||
test.txt: | |||||
name: /tmp/test.txt | |||||
source: http://example.com/test.txt | |||||
Ensure presence of file by specifying it's contents: | Ensure presence of file by specifying it's contents: | ||||
contents: | | contents: | | ||||
line1 | line1 | ||||
line2 | line2 | ||||
user: root | |||||
group: root | |||||
mode: 700 | |||||
dir_mode: 700 | |||||
encoding: utf-8 | |||||
hash: <<md5 hash>> | |||||
makedirs: true | |||||
linux: | |||||
system: | |||||
file: | |||||
/tmp/test.txt: | |||||
contents_pillar: linux:network:hostname | |||||
linux: | |||||
system: | |||||
file: | |||||
/tmp/test.txt: | |||||
contents_grains: motd | |||||
Kernel | Kernel | ||||
~~~~~~ | ~~~~~~ | ||||
{%- for file_name, file in system.file.iteritems() %} | {%- for file_name, file in system.file.iteritems() %} | ||||
{{ file_name }}: | |||||
linux_file_{{ file_name }}: | |||||
file.managed: | file.managed: | ||||
{%- if file.name is defined %} | |||||
- name: {{ file.name }} | |||||
{%- else %} | |||||
- name: {{ file_name }} | |||||
{%- endif %} | |||||
{%- if file.source is defined %} | {%- if file.source is defined %} | ||||
- source: {{ file.source }} | - source: {{ file.source }} | ||||
{%- if file.hash is defined %} | |||||
- source_hash: {{ file.hash }} | |||||
{%- else %} | |||||
- skip_verify: True | |||||
{%- endif %} | {%- endif %} | ||||
{%- if file.contents is defined %} | |||||
- contents: {{ file.contents }} | |||||
{%- endif %} | |||||
{%- if file.contents_pillar is defined %} | |||||
{%- elif file.contents is defined %} | |||||
- contents: {{ file.contents|yaml }} | |||||
{%- elif file.contents_pillar is defined %} | |||||
- contents_pillar: {{ file.contents_pillar }} | - contents_pillar: {{ file.contents_pillar }} | ||||
{%- elif file.contents_grains is defined %} | |||||
- contents_grains: {{ file.contents_grains }} | |||||
{%- endif %} | {%- endif %} | ||||
- makedirs: {{ file.get('makedirs', 'True') }} | - makedirs: {{ file.get('makedirs', 'True') }} | ||||
- user: {{ file.get('user', 'root') }} | - user: {{ file.get('user', 'root') }} | ||||
{%- if file.encoding is defined %} | {%- if file.encoding is defined %} | ||||
- encoding: {{ file.encoding }} | - encoding: {{ file.encoding }} | ||||
{%- endif %} | {%- endif %} | ||||
{%- if file.hash is defined %} | |||||
- source_hash: {{ file.hash }} | |||||
{%- else %} | |||||
- skip_verify: True | |||||
{%- endif %} | |||||
{%- endfor %} | {%- endfor %} | ||||
linux: | |||||
system: | |||||
enabled: true | |||||
file: | |||||
/tmp/sample.txt: | |||||
source: http://techslides.com/demos/samples/sample.txt | |||||
source_hash: 5452459724e85b4e12277d5f8aab8fc9 | |||||
sample2.txt: | |||||
name: /tmp/sample2.txt | |||||
source: http://techslides.com/demos/samples/sample.txt | |||||
test2: | |||||
name: /tmp/test2.txt | |||||
contents: | | |||||
line1 | |||||
line2 | |||||
user: root | |||||
group: root | |||||
mode: 700 | |||||
dir_mode: 700 | |||||
encoding: utf-8 | |||||
makedirs: true |