CDIST-TYPE__CONFIG_FILE(7)

πŸ’– CDIST-TYPE__CONFIG_FILE πŸ’–

okay bestie, welcome to cdist-type__config_file β€” yes that's the manual page name, it lives in section 7 of the cdist manuals, and it's literally the moment your config files stop being a whole thing. πŸŽ€


✨ NAME ✨

cdist-type__config_file β€” _Manages config files

like. it manages your config files. that's the whole job. she's focused, she's iconic, she ate. πŸ‘‘


🌸 DESCRIPTION 🌸

So here's the tea: this type deploys config files by handing the whole thing off to the file type. That's the engine, this is the vibe. πŸš—βœ¨

And then β€” and this is the part that's giving main character energy β€” it runs the given code if the file changes. Not always. Not on every run. Only when the file actually changes. Conditional queen behavior, no cap. πŸ’…


πŸ¦‹ REQUIRED PARAMETERS πŸ¦‹

None.

Yep. Zero. Nada. You don't have to give her anything. She's low-maintenance like that. 🫢


πŸŽ€ OPTIONAL PARAMETERS πŸŽ€

  • group β€” see cdist-type__file
  • mode β€” see cdist-type__file
  • onchange β€” the code to run if the file changes πŸ”₯
  • owner β€” see cdist-type__file
  • source β€” Path to the config file. And here's the cute lil trick: if source is '-' (a dash, yes literally just a dash), then whatever was written to stdin gets taken as the config file content. stdin girlies rise up πŸ™ˆ
  • state β€” see cdist-type__file
ngl, several of these just point you at cdist-type__file because that's where the real deets live. go read her page too, she's in SEE ALSO bestie, I got you. πŸ’œ

🌈 EXAMPLES 🌈

okay this is the moment. look at her. she's serving:

__config_file /etc/consul/conf.d/watch_foo.json \
   --owner root --group consul --mode 640 \
   --source "$__type/files/watch_foo.json" \
   --state present \
   --onchange 'service consul status >/dev/null && service consul reload || true'

like?? owner root, group consul, mode 640, source pulled from "$__type/files/watch_foo.json", state present, and an onchange that checks consul's status and reloads it β€” and if that check fails it just || trues its way out of drama. no stress. ⭐


πŸ’œ SEE ALSO πŸ’œ


πŸ‘‘ AUTHORS πŸ‘‘

Steven Armstrong <steven-cdist--@--armstrong.cc> πŸ’–


πŸ“ COPYING πŸ“

Copyright (C) 2015 Steven Armstrong. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

(that's the legal bit, and yes it's copy-paste-exact, licensing does NOT do vibes-based paraphrasing 😭)


ungleich GmbH 2021


and that's the whole page bestie!! πŸ’…βœ¨ this was version 7.0.0, dated Jul 31, 2022, straight out of the cdist source, page name CDIST-TYPE__CONFIG_FILE(7). go deploy something cute. πŸ¦‹πŸ’– mwah.

πŸ“¦ where this page comes from