Hello Markus
I think the file by design contains the IP address, and not the hostname, to avoid that a failure in name resolution could affect ability of the client to connect to the server and fetch policy updates. The documentation itself indicates that the file contains the IP of the policy server, not the name. See https://docs.cfengine.com/docs/3.24/overview-directory-structure.html#policy_server-dat
Ciao,
-- bronto
I do think that using an IP address is a bit more reliable. Instead of manipulating that file you could instead re-bootstrap with a command like cf-agent –no-lock –inform –bootstrap <newip>.
I typically advise against a re-bootstrap. It's a bit heavy handed, and if it fails it can leave you in worse position.
When you --bootstrap
, the content in $(sys.input_dir)
is wiped and completely re-seeded. If your bootstrap fails you will not have a full policy in inputs, where as if you re-write policy_server.dat
your existing policy will remain in place and the next time the agent starts it will resolve the new value for policy server.