Re: Bootstrap in chroot
"'Bas van der Vlies' via help-cfengine" <[email protected]> Mon, 20 May 2024 13:50:31 +0000
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
Markus,
I also bootstrap cfengine when a host has been provisioned. Only my options are different. Do no run policy.
```
/var/cfengine/bin/cf-agent --bootstrap="${IMAGESERVER}" --skip-bootstrap-policy-run
# I have a def.json setup with diferent json files. That is why I need this
/var/cfengine/bin/cf-agent -KI -f update.cf
```
When the server boots it wil run cfengne and everything is fine for use.
> On 20 May 2024, at 11:58, Markus Rexhepi-Lindberg <[email protected]> wrote:
>
> Is it possible to bootstrap a host running in a chroot?
>
> I want to bootstrap a host during its provisioning stage were it currently runs in a chroot environment. While bootstrapping cf-agent complains that the cf-execd daemon is not running, which seems to be the case since cfengine3.service is not allowed to start in a chroot environment.
>
> ```
> # chroot /target cf-agent -B <cfehub>
> notice: Bootstrap mode: implicitly trusting server, use --trust-server=no if server trust is already established
> notice: Trusting new key: MD5=<redacted>
> R: Bootstrapping from host '<redacted>' via built-in policy '/var/cfengine/inputs/failsafe.cf'
> R: This autonomous node assumes the role of voluntary client
> R: Updated local policy from policy server
> R: Triggered an initial run of the policy
> R: Restarted systemd unit cfengine3
> error: Bootstrapping failed, cf-execd is not running
> notice: Bootstrap mode: implicitly trusting server, use --trust-server=no if server trust is already established
> ```
>
> I managed to workaround this by first trying to bootstrap, which fails, then manually start cf-execd in the chroot and finally try to bootstrap again which succeeds.
>
> ```
> # chroot /traget cf-execd
> # chroot /target cf-agent -B <cfehub>
> R: Bootstrapping from host '<redacted>' via built-in policy '/var/cfengine/inputs/failsafe.cf'
> R: This autonomous node assumes the role of voluntary client
> R: Updated local policy from policy server
> R: Triggered an initial run of the policy
> notice: Bootstrap to '<redacted>' completed successfully!
> ```
>
> This works but feels like a hack. Is there another way this could be done?
>
> --
> Markus
>
> --
> You received this message because you are subscribed to the Google Groups "help-cfengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/e6e87828-d8aa-4040-9352-ef9e6f4a1f9bn%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/B0CB26A1-3164-44A3-AE44-3BEE5BED183A%40surf.nl.
smime.p7s
(application/pkcs7-signature, 4.6 KB) - not displayed