This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:cfengine/design-center
- Loading branch information
Showing
179 changed files
with
2,625 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
filetype plugin indent on | ||
|
||
autocmd BufRead,BufNewFile *.cf set ft=cf3 | ||
autocmd BufRead,BufNewFile *.asciidoc set ft=asciidoc | ||
|
||
set exrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file modified
0
examples/verticalsysadmin_training_examples/0005_simple_example.txt
100755 → 100644
Empty file.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
examples/verticalsysadmin_training_examples/0032_do_exercise_1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
EXERCISE | ||
|
||
--- | ||
A note on how to write cfengine policies: | ||
1. sysadmin problem | ||
2. envision the desired end state | ||
3. translate the desired end state into CFEngine Policy Language | ||
--- | ||
|
||
1. Write a policy to signal TERM and then KILL to any | ||
process matching "trn". | ||
|
||
Testing it: | ||
|
||
cp /bin/sleep ~/trn | ||
~/trn 1000 & | ||
cf-agent -f ... | ||
|
||
If you finish before everybody else, please study the | ||
Reference Manual, chapters 1 - 4. | ||
|
3 changes: 0 additions & 3 deletions
3
...icalsysadmin_training_examples/0060_Basic_Examples._Hello_world_using_command_bin_echo.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# commands | ||
# A promise to execute a command. | ||
|
||
bundle agent example | ||
{ | ||
|
||
|
Empty file.
Empty file modified
0
...min_training_examples/0150_Knowledge_management_is_one_of_the_key_challenges_of_scale.txt
100755 → 100644
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,7 @@ bundle edit_line proper_greetings { | |
|
||
insert_lines: | ||
|
||
"Good morning, how are you today?"; | ||
|
||
"Good morning!"; | ||
|
||
} | ||
|
4 changes: 4 additions & 0 deletions
4
examples/verticalsysadmin_training_examples/0166_exercise.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
EXERCISE | ||
|
||
Write a policy to create /tmp/myname.txt and put | ||
your name in it. |
17 changes: 17 additions & 0 deletions
17
...ining_examples/0167a_Basic_Examples.__Editing_Files._Edit_a_file,_expand_from_template.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
bundle agent example { | ||
|
||
files: | ||
|
||
"/etc/motd" | ||
|
||
edit_line => ExpandMeFrom("/tmpl/motd.tmpl"); | ||
} | ||
|
||
bundle edit_line ExpandMeFrom(source) { | ||
|
||
insert_lines: | ||
|
||
"$(source)" | ||
|
||
insert_type => "file"; | ||
} |
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
...ining_examples/0167c_Basic_Examples.__Editing_Files._Edit_a_file,_expand_from_template.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
bundle agent example { | ||
|
||
files: | ||
|
||
"/etc/motd" | ||
|
||
edit_line => ExpandMeFrom("/tmpl/motd.tmpl"); | ||
} | ||
|
||
bundle edit_line ExpandMeFrom(source) { | ||
|
||
delete_lines: | ||
|
||
".*"; | ||
|
||
insert_lines: | ||
|
||
"$(source)" | ||
|
||
insert_type => "file", | ||
expand_scalars => "true"; | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/verticalsysadmin_training_examples/0168a_variable_scope.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Note: a fully qualified variable consists of the bundle | ||
name wherein the variable is defined plus the variable | ||
name. Example: | ||
|
||
bundle agent mybundle { vars: "myvar" string => "myvalue"; } | ||
|
||
$(myvar) <--- unqualified | ||
|
||
$(mybundle.myvar) <--- fully qualified (complete with scope) | ||
|
29 changes: 29 additions & 0 deletions
29
examples/verticalsysadmin_training_examples/0168b_exercise.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
EXERCISE | ||
|
||
|
||
(If you finish early, please study the Reference | ||
Manual, chapters 1 - 4; then the special topic guide | ||
on the Editing File Content) | ||
|
||
|
||
Manually create a template. Embed a variable into the template: | ||
|
||
echo 'Hello, $(mybundle.myname). The time is $(sys.date).' > /tmp/file.tmpl | ||
|
||
Now write a policy to populate contents of /tmp/file.txt | ||
using this template file, /tmp/file.tmpl. | ||
|
||
Make sure your bundle defines the variable embedded in the | ||
template, and that your bundle name matches the bundle name | ||
embedded in the template. | ||
|
||
Your policy should use an edit_lines bundle containing an | ||
insert_lines promise with the following attributes: | ||
|
||
insert_type => "file", | ||
expand_scalars => "true"; | ||
|
||
If you finish before rest of the group, finish studying | ||
the CFEngine Reference Manual chapters 1 -4, and if you | ||
finish that, then study the Special Topic guide on Editing | ||
File Content. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Classes |
10 changes: 10 additions & 0 deletions
10
examples/verticalsysadmin_training_examples/0201_class_expression_operators.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
. and | ||
|
||
& and (synonym for .) | ||
|
||
| or | ||
|
||
|
||
( ) groupers | ||
|
18 changes: 9 additions & 9 deletions
18
...ples/verticalsysadmin_training_examples/0210_Patterns._Classes._Report_day_of_the_week.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
bundle agent example { | ||
|
||
reports: Monday:: "Hello world! I love Mondays!"; | ||
reports: Tuesday:: "Hello world! I love Tuesdays!"; | ||
reports: Wednesday:: "Hello world! I love Wednesdays!"; | ||
reports: Thursday:: "Hello world! I love Thursdays!"; | ||
reports: Friday:: "Hello world! I love Fridays!"; | ||
reports: Saturday:: "Hello world! I love weekends!"; | ||
reports: Sunday:: "Hello world! I love weekends!"; | ||
} | ||
reports: Monday:: "Hello world! I love Mondays!"; | ||
reports: Tuesday:: "Hello world! I love Tuesdays!"; | ||
reports: Wednesday:: "Hello world! I love Wednesdays!"; | ||
reports: Thursday:: "Hello world! I love Thursdays!"; | ||
reports: Friday:: "Hello world! I love Fridays!"; | ||
|
||
reports: Saturday:: "Hello world! I love weekends!"; | ||
reports: Sunday:: "Hello world! I love weekends!"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
examples/verticalsysadmin_training_examples/0252_logical_not.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
bundle agent example { | ||
|
||
reports: | ||
|
||
linux:: | ||
|
||
"Yay Linux!"; | ||
|
||
|
||
reports: | ||
|
||
!linux:: | ||
|
||
"I miss my Linux..."; | ||
|
||
reports: | ||
|
||
!windows:: | ||
|
||
"Thank goodness it ain't Windows."; | ||
} |
Oops, something went wrong.