I'm looking for a way to set CoreOS sysctl
settings during its cloud-init
stage.
The CoreOS version of cloud-init
only allows for a handful of configuration directives and is not the same as the regular cloud-init
. For example, there is no runcmd
section (see http://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/).
systemd
provides a way to manage sysctl
settings though files (http://www.freedesktop.org/software/systemd/man/sysctl.d.html). I am using the CoreOS cloud-init
write_files
section to create a file at /etc/sysctl.d/50-nf_conntrack.conf
. But it won't be picked up because the CoreOS cloud configuration happens after the sysctl.d
configuration has already taken place.
Perhaps I could somehow use another systemd
unit file to restart the sysctl.d
unit? How could this be accomplished?
See answer on CoreOS github issue tracker: https://github.com/coreos/bugs/issues/747#issuecomment-142764415
Thanks for others for some tips.
You can do this to run arbitrary commands similar to runcmd.
You can simply call
sysctl
on the file yourself to make the settings take effect immediately, and the configuration file will be used for later reboots (if your instance is persistent).I'd use a run command for this.