/srv/irclogs.ubuntu.com/2022/11/29/#cloud-init.txt

Deckard111hey everyone ;)11:55
Deckard111quick question: In which order is the yamol configuration executed? would it be possible to have several 'users' sections? 11:56
Deckard111I would like to create a user and write a file into the user directory.11:57
Deckard111But I have other files I need to write before that11:57
Deckard111so if I write the files first, the user directory is not there, and if I create the user first, then other files are missing.11:57
Deckard111That's why I am asking ;)11:58
acibaDeckard111: Hello!12:05
acibaNot sure about the use case but, there are two module that could serve as a pre-hook and post-hook repectively: https://cloudinit.readthedocs.io/en/latest/topics/modules.html#bootcmd and https://cloudinit.readthedocs.io/en/latest/topics/modules.html#runcmd. More info: https://cloudinit.readthedocs.io/en/latest/topics/boot.html12:07
acibaSo you could execute arbitrary code with cc_bootcmd before cc_users_groups and with cc_run_cmd after after cc_user_groups is executed, allowing you to do any additional handling needed12:08
Deckard111ok, thank you - will look into it12:10
minimalDeckard111: you can only have a single "users:" section and all users will created at the same time12:41
minimalthe order that c-i modules are defined in the /etc/cloud/cloud.cfg file controls the order that they are executed but I would not recommend changing the order12:42
minimalwhat files do you need to create before users creation?12:43
minimalDeckard111: write_files runs before user creation but you can also specify "defer: true" in a write_files section for it to instead run late in the configuration sequence12:46
=== cpaelzer_ is now known as cpaelzer
Deckard111Thank you everyone for the responses!19:02

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!