/srv/irclogs.ubuntu.com/2024/08/19/#cloud-init.txt

h3kI'm trying to deploy a VM using cloud-init. I want to install ansible using packages and use it later in runcmd. However it looks like for some reason runcmd gets executed before apt finishes installing the package. How can I troubleshoot that?16:57
h3k(Running in vmware vcloud director, ubuntu noble-server-cloudimg-amd64)16:57
h3kCurrently I can apt-get install ansible in runcmd itself, but this seems hacky.16:57
minimalh3k: if you're trying to use "packages:\n- ansible\n" in user-data the packages_update_upgrade_install module is run in the 'final' stage whereas 'runcmd' is run in the earlier 'config' stage17:16
minimalyou can check this in /etc/cloud/cloud.cfg17:16
h3kOh no, now it makes sense. I guess I can't customize this using other variables?17:20
h3kminimal: sorry, forgot to tag you17:21
minimalh3k: there is an ansible module which can install ansible if required17:23
minimalthough I'm haven't checked if it can be used to only install ansible (rather than also run a playbook etc)17:24
h3kminimal: The ansible module also runs after runcmd. I could probably use scripts_user together with write_files and wouldn't need to change the cloud.cfg and still use packages.17:28
minimalwhat has runcmd got to do with runcmd though?17:30
minimaloops, runcmd got to do with ansible?17:30
h3kminimal: I need to run an ansible-playbook directly on the host and some other commands as well. Until now I installed ansible and ran ansible directly in runcmd.17:33
minimalh3k: I did point out that the cloud-init ansible module is precisely designed to do this...17:36
minimalto install ansible, pull a playbook, and run it17:37
h3kminimal: I think I didn't get that it would do all my stuff. I'll try, thanks.17:37
minimallook at the docs for cc_ansible17:37
minimaland the examples17:38
h3kminimal: It seems not to work in my case because ansible is not in the repo root and I can't find a way to set playbook_dir or a simliar setting to somehow chdir into the ansible folder first18:08
minimalh3k: I haven't yet used the ansible module so I'm not familiar with its various options but what you mention sounds like either a bug or a feature request18:22
minimalh3k: open a cloud-init github Issue for it?18:28
=== dbungert1 is now known as dbungert

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