examples: Update the examples

This commit is contained in:
James Shubin
2017-02-06 16:28:16 -05:00
parent eb59861d4d
commit 5bdd2ca02f
7 changed files with 99 additions and 26 deletions

View File

@@ -1,14 +1,13 @@
--- ---
graph: mygraph graph: mygraph
comment: You can test Watch and CheckApply failures with chmod ugo-r and chmod ugo-w.
resources: resources:
file: file:
- name: file1 - name: file1
path: "/tmp/mgmt/f1"
meta: meta:
retry: 3 limit: .inf
delay: 5000 burst: 0
path: "/tmp/mgmt/hello"
content: | content: |
i am f1 i am a file
state: exists state: exists
edges: [] edges: []

View File

@@ -1,13 +0,0 @@
---
graph: mygraph
resources:
file:
- name: file1
meta:
limit: .inf
burst: 0
path: "/tmp/mgmt/hello"
content: |
i am a file
state: exists
edges: []

View File

@@ -3,11 +3,11 @@ graph: mygraph
resources: resources:
file: file:
- name: file1 - name: file1
path: "/tmp/mgmt/f1"
meta: meta:
limit: 0.5 limit: 0.2
burst: 3 burst: 5
path: "/tmp/mgmt/limit"
content: | content: |
i am f1 i am a normal file
state: exists state: exists
edges: [] edges: []

30
examples/noop2.yaml Normal file
View File

@@ -0,0 +1,30 @@
---
graph: mygraph
comment: dangerous noop example
resources:
noop:
- name: noop1
meta:
noop: true
file:
- name: file1
path: "/tmp/mgmt/hello-noop"
content: |
hello world from @purpleidea
state: exists
meta:
noop: true
exec:
- name: exec1
meta:
noop: true
cmd: 'rm -rf /'
shell: '/bin/bash'
timeout: 0
watchcmd: ''
watchshell: ''
ifcmd: ''
ifshell: ''
pollint: 0
state: present
edges: []

View File

@@ -7,18 +7,18 @@ resources:
poll: 5 poll: 5
path: "/tmp/mgmt/f1" path: "/tmp/mgmt/f1"
content: | content: |
i am f1 i poll every 5 seconds
state: exists state: exists
- name: file2 - name: file2
path: "/tmp/mgmt/f2" path: "/tmp/mgmt/f2"
content: | content: |
i am f2 i use the event based watcher
state: exists state: exists
- name: file3 - name: file3
meta: meta:
poll: 1 poll: 1
path: "/tmp/mgmt/f3" path: "/tmp/mgmt/f3"
content: | content: |
i am f3 i poll every second
state: exists state: exists
edges: [] edges: []

57
examples/retry1.yaml Normal file
View File

@@ -0,0 +1,57 @@
---
graph: mygraph
comment: You can test Watch and CheckApply failures with chmod ugo-r and chmod ugo-w.
resources:
exec:
- name: exec1
cmd: 'touch /tmp/mgmt/no-read && chmod ugo-r /tmp/mgmt/no-read'
shell: '/bin/bash'
timeout: 0
watchcmd: ''
watchshell: ''
ifcmd: ''
ifshell: ''
pollint: 0
state: present
- name: exec2
cmd: 'touch /tmp/mgmt/no-write && chmod ugo-w /tmp/mgmt/no-write'
shell: '/bin/bash'
timeout: 0
watchcmd: ''
watchshell: ''
ifcmd: ''
ifshell: ''
pollint: 0
state: present
file:
- name: noread
path: "/tmp/mgmt/no-read"
meta:
retry: 3
delay: 5000
content: |
i am f1
state: exists
- name: nowrite
path: "/tmp/mgmt/no-write"
meta:
retry: 3
delay: 5000
content: |
i am f1
state: exists
edges:
- name: e1
from:
kind: exec
name: exec1
to:
kind: file
name: noread
- name: e2
from:
kind: exec
name: exec2
to:
kind: file
name: nowrite

View File

@@ -4,7 +4,7 @@ comment: timer example
resources: resources:
timer: timer:
- name: timer1 - name: timer1
interval: 30 interval: 3
exec: exec:
- name: exec1 - name: exec1
cmd: echo hello world cmd: echo hello world