Change-Id: Ia286ac4377c6b03ce16c9dc1a5c7d3441efe7e12pull/144/head
@@ -350,13 +350,20 @@ Ensure presence of file by specifying it's source: | |||
file: | |||
/tmp/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: | |||
@@ -369,13 +376,19 @@ Ensure presence of file by specifying it's contents: | |||
contents: | | |||
line1 | |||
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 | |||
~~~~~~ | |||
@@ -3,16 +3,26 @@ | |||
{%- for file_name, file in system.file.iteritems() %} | |||
{{ file_name }}: | |||
linux_file_{{ file_name }}: | |||
file.managed: | |||
{%- if file.name is defined %} | |||
- name: {{ file.name }} | |||
{%- else %} | |||
- name: {{ file_name }} | |||
{%- endif %} | |||
{%- if file.source is defined %} | |||
- source: {{ file.source }} | |||
{%- if file.hash is defined %} | |||
- source_hash: {{ file.hash }} | |||
{%- else %} | |||
- skip_verify: True | |||
{%- 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 }} | |||
{%- elif file.contents_grains is defined %} | |||
- contents_grains: {{ file.contents_grains }} | |||
{%- endif %} | |||
- makedirs: {{ file.get('makedirs', 'True') }} | |||
- user: {{ file.get('user', 'root') }} | |||
@@ -26,11 +36,6 @@ | |||
{%- if file.encoding is defined %} | |||
- encoding: {{ file.encoding }} | |||
{%- endif %} | |||
{%- if file.hash is defined %} | |||
- source_hash: {{ file.hash }} | |||
{%- else %} | |||
- skip_verify: True | |||
{%- endif %} | |||
{%- endfor %} | |||
@@ -0,0 +1,21 @@ | |||
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 |