I just started with CFEngine. I have 1 policy servers and 2 clients (Ubuntu 14.04 Desktop , Ubuntu 12.04 Desktop).
Started with creating a local policy on the Ubuntu 14.04 Desktop with CFEngine agent installed on it.
This policy removes an existing "telnet" client.
That local policy worked fine. So I wanted to use the policy on my policy server which then should push it to the clients after 5 minutes. This does not work.
These are the steps I did on the policy server: Step1: Create a file remove_packages.cf in the /var/cfengine/masterfiles directory
bundle agent remove_packages
{
methods:
"telnet" usebundle => package_absent("telnet");
}
Step2: vi promises.cf in the /var/cfengine/masterfiles directory and add
body common control
{
bundlesequence => {
remove_packages,
Step3: vi promises.cf in the /var/cfengine/masterfiles directory and add
inputs => {
# JF 15/08/2014 remove telnet package
"remove_packages.cf",
};
Step4: Check on mistakes
root@ubuntu:/var/cfengine/masterfiles# cf-promises ./promises.cf
Step5: Wait 5 minutes until it replicates to the clients..
Here nothing happens at the clients ... As you can see it is still present:
root@ubu14client:~# which telnet
/usr/bin/telnet
Can somebody explain me why it does not work?
I upvoted your question just for the inclusion of careful step by step sequence of what you did. I thought I would mention the remaining debugging steps you could have taken, that may have shown you what was wrong more easily (and more directly) than just googling around:
Step 6: Run the update policy on a bootstrapped host to pick up the changed policy files.
If you like, run it in verbose mode (with color for ease of reading):
If the update policy just ran, you may need to override the time locks with
-K
:Step 7: Run the agent in verbose mode on the bootstrapped host (just the default promises.cf rather than the update policy)
The verbose output can be very verbose, but it's good to learn to sift through it. You can virtually always find everything you need to diagnose/debug a problem by running in verbose mode.