Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion content/examples/_index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,9 @@ from the example.
For example, the LDAP query in `active_directory.cf` needs a domain name.
In the variable declaration, replace "cftesting" with your domain name:

{{< CFEngine_include_snippet(integrating_the_example_into_your_main_policy.cf, .* ) >}}
```cf3 {skip TODO}
vars:
# NOTE: Edit this to your domain, e.g. "corp"
"domain_name"
string => "cftesting";
```
1 change: 0 additions & 1 deletion content/examples/example-snippets/_index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ aliases:
- [Software administration examples][Software administration examples]
- [Commands, scripts, and execution examples][Commands, scripts, and execution examples]
- [File and directory examples][File and directory examples]
- [File template examples][File template examples]
- [Database examples][Database examples]
- [Network examples][Network examples]
- [System security examples][System security examples]
Expand Down
2 changes: 1 addition & 1 deletion content/examples/example-snippets/all_hosts_the_same.cf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bundle agent central
vars:
"policy_server" string => "myhost.domain.tld";
"mypackages" slist => {
"nagios"
"nagios",
"gcc",
"apache2",
"php5"
Expand Down
19 changes: 18 additions & 1 deletion content/examples/example-snippets/basic-file-directory.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,24 @@ Also you could write this using a list variable:

## Copy files

{{< CFEngine_include_snippet(copy_files.cf, .* ) >}}
```cf3 {skip TODO}
files:
"/var/cfengine/inputs"
handle => "update_policy",
perms => m("600"),
copy_from => u_scp("$(master_location)",@(policy_server)),
depth_search => recurse("inf"),
file_select => input_files,
action => immediate;

"/var/cfengine/bin"
perms => m("700"),
copy_from => u_scp("/usr/local/sbin","localhost"),
depth_search => recurse("inf"),
file_select => cf3_files,
action => immediate,
classes => on_change("reload");
```

## Copy and flatten directory

Expand Down
19 changes: 0 additions & 19 deletions content/examples/example-snippets/copy_files.cf

This file was deleted.

5 changes: 0 additions & 5 deletions content/examples/example-snippets/database_creation.cf
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ body knowledge control
sql_type => "postgres";
}

bundle knowledge dummy
{
topics:
}

body common control
{
bundlesequence => { "databases" };
Expand Down
4 changes: 2 additions & 2 deletions content/examples/example-snippets/deleting_lines_exception.cf
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ bundle agent testbundle
files:
"/tmp/passwd_excerpt"
create => "true",
edit_line => MarkNRoot;
edit_line => mark_n_root;
}
########################################################

bundle edit_line MarkNRoot
bundle edit_line mark_n_root
{
delete_lines:
"mark.*|root.*" not_matching => "true";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body common control
{
version => "1.2.3";
inputs => { "$(sys.libdir)/stdlib.cf" };
bundlesequence => { "SetRootPassword" };
bundlesequence => { "set_root_password" };
}
########################################################

Expand All @@ -19,7 +19,7 @@ bundle common g
}
########################################################

bundle agent SetRootPassword
bundle agent set_root_password
{
vars:
# Or get variables directly from server with Enterprise
Expand All @@ -32,11 +32,11 @@ bundle agent SetRootPassword
# or $(pw_class)-root.txt

"/tmp/shadow"
edit_line => SetRootPw;
edit_line => set_root_password;
}
########################################################

bundle edit_line SetRootPw
bundle edit_line set_root_password
{
vars:
# Assume this file contains a single string of the form root:passwdhash:
Expand Down
8 changes: 4 additions & 4 deletions content/examples/example-snippets/editing_tabular_files.cf
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ bundle agent testbundle

"/home/mark/tmp/passwd"
create => "true",
edit_line => SetUserParam("mark","6","/set/this/shell");
edit_line => set_user_param("mark","6","/set/this/shell");

"/home/mark/tmp/group"
create => "true",
edit_line => AppendUserParam("root","4","@(userset)");
edit_line => append_user_param("root","4","@(userset)");

commands:
"/bin/echo" args => $(userset);
}
########################################################

bundle edit_line SetUserParam(user,field,val)
bundle edit_line set_user_param(user,field,val)
{
field_edits:
"$(user):.*"
Expand All @@ -46,7 +46,7 @@ bundle edit_line SetUserParam(user,field,val)
}
########################################################

bundle edit_line AppendUserParam(user,field,allusers)
bundle edit_line append_user_param(user,field,allusers)
{
vars:
"val" slist => { @(allusers) };
Expand Down
2 changes: 1 addition & 1 deletion content/examples/example-snippets/ensure_running_1.cf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bundle agent CFEngine_processes
bundle agent cfengine_processes
{
vars:

Expand Down
28 changes: 0 additions & 28 deletions content/examples/example-snippets/file-template.markdown

This file was deleted.

20 changes: 9 additions & 11 deletions content/examples/example-snippets/general.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ To get started with CFEngine, you can imagine the following template for enterin

## The general pattern

The general pattern of the syntax is like this (colors in html version: red, CFEngine word; blue, user-defined word):
The general pattern of the syntax is like this:

```cf3
```cf3 {skip}
bundle component name(parameters)
{
what_type:
where_when::

## Traditional comment

"promiser" -> { "promisee1", "promisee2" },
what_type:
where_when::
## Traditional comment
"promiser" -> { "promisee1", "promisee2" },
comment => "The intention ...",
handle => "unique_id_label",
attribute_1 => body_or_value1,
attribute_2 => body_or_value2;
handle => "unique_id_label",
attribute_1 => body_or_value1,
attribute_2 => body_or_value2;
}
```

Expand Down
12 changes: 6 additions & 6 deletions content/examples/example-snippets/inserting_lines_in_a_file.cf
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ bundle agent insert
files:
"/tmp/test_insert"
create => "true",
edit_line => Insert("$(insert.v)");
edit_line => insert_name("$(insert.v)");
}
#######################################################
# For the library
#######################################################

bundle edit_line Insert(name)
bundle edit_line insert_name(name)
{
insert_lines:
" $(name)"
Expand Down Expand Up @@ -66,14 +66,14 @@ bundle agent insert
files:
"/tmp/test_insert"
create => "true",
edit_line => Insert("$(insert.v)"),
edit_line => insert_name("$(insert.v)"),
edit_defaults => empty;
}
#######################################################
# For the library
#######################################################

bundle edit_line Insert(name)
bundle edit_line insert_name(name)
{
insert_lines:
"Begin$(const.n)$(name)$(const.n)End";
Expand Down Expand Up @@ -112,15 +112,15 @@ bundle agent insert
files:
"/tmp/test_insert"
create => "true",
edit_line => Insert("@(insert.v)");
edit_line => insert_name("@(insert.v)");
# edit_defaults => empty;

}
#######################################################
# For the library
#######################################################

bundle edit_line Insert(name)
bundle edit_line insert_name(name)
{
insert_lines:
"$(name)";
Expand Down

This file was deleted.

46 changes: 0 additions & 46 deletions content/examples/example-snippets/macro_template_1.cf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bundle edit_line prefix_postfix
}
########################################################

bundle edit_line AppendIfNSL(parameter)
bundle edit_line append_if_nsl(parameter)
{
insert_lines:
"$(parameter)"; # This is default
Expand Down
51 changes: 0 additions & 51 deletions content/examples/example-snippets/set_up_name_resolution_1.cf

This file was deleted.

Loading
Loading