Skip to content

Experiment: Write a new policy writing crash course#3600

Draft
olehermanse wants to merge 1 commit intocfengine:masterfrom
olehermanse:experiment
Draft

Experiment: Write a new policy writing crash course#3600
olehermanse wants to merge 1 commit intocfengine:masterfrom
olehermanse:experiment

Conversation

@olehermanse
Copy link
Member

No description provided.

@olehermanse olehermanse added the WIP work in progress label Feb 16, 2026
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>

Key points:

- `bundle agent __main__` -- a bundle of type `agent`, named `__main__`. The `__main__` name tells CFEngine to run this bundle when executing the file directly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, don't include this if you also have bundle main in that file.

}
```

- `create => "true"` ensures the file exists.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary here.

bundle agent __main__
{
commands:
"/usr/bin/systemctl restart nginx"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nay this wont work.
its not in a shell.

typically just the command, and then there is args or argslist.


commands:
"/usr/bin/systemctl"
args => "reload $(service)";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe argslist

bundle agent ensure_user(name)
{
commands:
"/usr/sbin/useradd $(name)"
Copy link
Member

@nickanderson nickanderson Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax error in shell, or move args to args or arglist

}
```

Common functions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird choice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP work in progress

Development

Successfully merging this pull request may close these issues.

2 participants

Comments