By looking at runcmd code (/usr/lib/python2.6/site-packages/cloudinit/config/cc_runcmd.py) I noticed there's no 'frequency' specified in comparison to other. Beside the only thing that scripts does is to save the scripts given as shells script under /var/lib/cloud/instance/scripts/runcmd .
So if I verbosely specify the modules, I MUST set the frequency.
cloud_config_modules:
- mounts
- locale
- set-passwords
- timezone
- [ runcmd, always ]
cloud_final_modules:
- scripts-per-once
- scripts-per-boot
- scripts-per-instance
- [ scripts-user, always ]
- ssh-authkey-fingerprints
and the scripts created by this particular can be run by 'scripts-user', so I need to specify i.e.
- [ scripts-user, always ]
to make runcmd scripts working
Is it proper way to do so ? The documentation (at least current 0.7.7) lacks proper explanation of runcmd and user-scripts and how they can be utilized
I also don't understand difference between all the mode, once (first time the instance boot), instance(???), always ( that I understand), ????boot(that one exist? it doesn't seem to work...
EDIT:
ok, i have found in cloudinit/settings.py:
# Valid frequencies of handlers/modules
PER_INSTANCE = "once-per-instance"
PER_ALWAYS = "always"
PER_ONCE = "once"
and beside I found an explanation in this script:
[root@euca-10-254-97-216 ~]# cloud-init-per -h
Usage: cloud-init-per frequency name cmd [ arg1 [ arg2 [ ... ] ]
run cmd with arguments provided.
This utility can make it easier to use boothooks or bootcmd
on a per "once" or "always" basis.
If frequency is:
* once: run only once (do not re-run for new instance-id)
* instance: run only the first boot for a given instance-id
* always: run every boot
But I don't catch the difference between 'once' and 'instance'. So if the same image (rather snapshot) with new instance id in the case 'once' it won't start ? in case 'instance' it will ?