beantaxiHola all. Revisiting a question of mine from ealier today ...01:39
beantaxiI have a VPS on OVHCloud. They use cloud-init. Data Source = OpenStack. I see no obvious onramps like AWS/EC2 provides to make cloud-init initialize an instance with my scripts. How does one do this? Thanks!01:39
beantaxiFrom the code, the systemd services, and cloud-init --help, it looks like scripts are run during the final stage, which can be manually invoked by cloud-init modules --mode final. But, despite spending some time (re)visiting main.py, stages.py, cc_script_user.py, etc, I can't quite figure out how cloud-init 'knows' it's already run a per-instance script so it knows not to run it again. Thanks!07:00
meenathat knowledge is stored in /var/lib/cloud-init07:39
meenacloud-init and can be mademade to forget07:39
beantaximeena: Thanks you ... I'm not seeing /var/lib/cloud-init.16:08
beantaxi('thanks you' ... good heavens)16:09
beantaxiI do see a /var/lib/cloud/sem/ which looks like it might be relevant16:20
beantaxiFrom a look at some of the code in helpers.py, around Runners and FileSemaphores and such, it looks as though it's checking for files in that folder and bailing if they already exist.16:35
beantaxiAnd my /v/l/c/sem folder has one file named config_scripts_per_once.once. So I guess I _cloud_ just copy script files to /v/l/c/s/per-* folders, but that seems a little hacky, and that I'd be better off creating a proper cloud config file or gzip and coercing cloud-init to work with that file16:43
beantaxiHow might I do that?16:44
meenabeantaxi, yes, i got the folder wrong, but in there there's all the info cloud-init needs to decide whether it needs to run or not16:51
beantaximeena: Thanks! I was offline for a few hours, so I may have missed some messages. But now that I have some more clues, I'm going to reread the docs and see what clicks.20:23
beantaxiK. So it looks like I can create my userdata file with make-mime as per usual ... copy it to /var/lib/cloud/instance ... then follow a few cloud init steps from the FAQ ... and then reboot, and my initialization script should get executed.21:00
beantaxiOne question: how exactly does cloud-init know its been run per-instance? The /v/l/c/sem folder has a per.once file but that's it. Thanks!21:00
meenawe had that recently documented21:09
meenalet me see if i can find it21:09
meenahttps://cloudinit.readthedocs.io/en/latest/topics/faq.html that's a good start21:15
beantaxiThanks ... I read that and the First Boot Determination as well. They were both very helpful, but neither had detail on what file is used to indicate the instance has already booted. But perhaps that is the point of the /var/lib/cloud/instance/sem folder, as opposed to the /var/lib/cloud/sem folder? (I just now found the instance level sem folder)21:23
meenathey should just be links to each other21:47
meenasee, in theory, something in your virtual machine could change, and then your cloud decides this is a new instance and it needs a new instance id and it needs a new run, one that's essentially like the first run21:49
beantaxiI see two separate folders, /var/lib/cloud/sem and /var/lib/cloud/instance/sem. /v/l/c/sem has just one file: config_scripts_per_once.once. /v/l/c/instance/sem has many files, all of the form config_XXX, all of which seem to correspond to stages listed in /etc/cloud/cloud.cfg though I did not check every single one.22:58
beantaxiAnd /v/l/c/instance is indeed symlinked to /v/l/c/instance-very-long-guid, which I read is there in case this happens to a volume or filesystem that began life on one instance but the got started up when attached to a different instance, and so cloud-init can determine if it needs to run again; and there's a flag that controls this behavior in cases where that behavior is not what you want.23:00

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