cloud-init team mailing list archive
-
cloud-init team
-
Mailing list archive
-
Message #00152
cloud-init run command executed on every boot
Hello cloud-init experts. I have two basic question regarding cloud-init
I have recently created an ubuntu server vm (using VBox) and I want to use
the cloud-init service specifically the runcmd functionality. I am creating
a file foo.yaml having the content below
#cloud-config
# run commands
# default: none
# runcmd contains a list of either lists or a string
# each item will be executed in order at rc.local like level with
# output to the console
# - runcmd only runs during the first boot
# - if the item is a list, the items will be properly executed as if
# passed to execve(3) (with the first arg as the command).
# - if the item is a string, it will be simply written to the file and
# will be interpreted by 'sh'
#
# Note, that the list has to be proper yaml, so you have to quote
# any characters yaml would eat (':' can be problematic)
runcmd:
- [ ls, -l, / ]
- [ sh, -xc, "echo $(date) ': hello world!'" ]
- [ sh, -c, echo "=========hello world'=========" ]
- ls -l /root
- [ wget, "http://slashdot.org", -O, /tmp/index.html ]
The question is. How can I configure my vm via cloud init so that the
aforementioned runcmd is executed *everytime* the vm boots.
The second question is how will I use this foo.yml so that the this runcmd is
executed only once when the the vm is created. The vm will be created
through openstack and Vbox.
Thanks in advance
--
Konstantinos G. Papadopoulos, Dr-Eng.
Software Development Engineer
Intracom Telecom S.A., IXG
Marinou Antipa 41, Pilaia,
Thessaloniki, Greece, GR 57001
tel : +30-2310-497459 (int.: 3959)
e-mail: konstantinos.papadopoulos@xxxxxxxxxxxx
: konstantinos.papadopoulos@xxxxxxxxxxx
: konpap@xxxxxxxxxxxxxxxxxxxx
url : www.intracom-telecom.com
<kostis.g.papadopoulos@xxxxxxxxx>
Follow ups