Yes indeed. Put a script in /var/lib/cloud/scripts/per-boot, it will be executed at every boot (hopefully after networking is up). In it you could inspect /var/lib/dhcp/blah for the full hostname or domain name and amend /etc/hosts as you need.
HTH Lucian -- Sent from the Delta quadrant using Borg technology! Nux! www.nux.ro ----- Original Message ----- > From: "S. Brüseke - proIO GmbH" <s.brues...@proio.com> > To: users@cloudstack.apache.org > Sent: Friday, 11 March, 2016 10:59:58 > Subject: AW: AW: AW: AW: cloud-init and user-data/meta-data > But DHCP will not alter /etc/hosts as far as I know. > > By per-boot hack you mean to write a script and run it via cloud-init at boot > time? > > Mit freundlichen Grüßen / With kind regards, > > Swen > > > -----Ursprüngliche Nachricht----- > Von: Nux! [mailto:n...@li.nux.ro] > Gesendet: Freitag, 11. März 2016 11:54 > An: users@cloudstack.apache.org; S. Brüseke - proIO GmbH > Betreff: Re: AW: AW: AW: cloud-init and user-data/meta-data > > I am using cloud-init in the templates, but as I said I have not looked that > much into it. I just let DHCP do its job. > I would look at the per-boot scripts hack. :) > > -- > Sent from the Delta quadrant using Borg technology! > > Nux! > www.nux.ro > > ----- Original Message ----- >> From: "S. Brüseke - proIO GmbH" <s.brues...@proio.com> >> To: users@cloudstack.apache.org >> Sent: Friday, 11 March, 2016 10:50:04 >> Subject: AW: AW: AW: cloud-init and user-data/meta-data > >> To me it looks like CS needs to extend the user-data/meta-data with >> "hostname". >> >> Are you using cloud-init in your templates? How to you edit /etc/hosts >> with correct values? >> >> Mit freundlichen Grüßen / With kind regards, >> >> Swen >> >> >> -----Ursprüngliche Nachricht----- >> Von: Nux! [mailto:n...@li.nux.ro] >> Gesendet: Freitag, 11. März 2016 11:38 >> An: users@cloudstack.apache.org; S. Brüseke - proIO GmbH >> Betreff: Re: AW: AW: cloud-init and user-data/meta-data >> >> Swen, >> >> I am not very familiar with it, but unless they have a proper module >> in place to deal with DHCP as they do with the hosts file, you can >> always add a script in /var/lib/cloud/scripts/per-boot to check the >> dhcp info in /var/lib/dhcp and perform stuff based on it. >> Not exactly kosher, but hey .. >> >> -- >> Sent from the Delta quadrant using Borg technology! >> >> Nux! >> www.nux.ro >> >> ----- Original Message ----- >>> From: "S. Brüseke - proIO GmbH" <s.brues...@proio.com> >>> To: users@cloudstack.apache.org >>> Sent: Friday, 11 March, 2016 10:34:22 >>> Subject: AW: AW: cloud-init and user-data/meta-data >> >>> yes, but cloud-init is rewriting the /etc/hosts file and it does not >>> have access to DHCP information or does it? >>> >>> Mit freundlichen Grüßen / With kind regards, >>> >>> Swen >>> >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Nux! [mailto:n...@li.nux.ro] >>> Gesendet: Freitag, 11. März 2016 11:31 >>> An: S. Brüseke - proIO GmbH >>> Cc: users@cloudstack.apache.org >>> Betreff: Re: AW: cloud-init and user-data/meta-data >>> >>> Ah I see. >>> Well, afaik the fqdn should be provided via DHCP, right? >>> >>> -- >>> Sent from the Delta quadrant using Borg technology! >>> >>> Nux! >>> www.nux.ro >>> >>> ----- Original Message ----- >>>> From: "S. Brüseke - proIO GmbH" <s.brues...@proio.com> >>>> To: "Nux!" <n...@li.nux.ro>, users@cloudstack.apache.org >>>> Sent: Friday, 11 March, 2016 10:29:41 >>>> Subject: AW: cloud-init and user-data/meta-data >>> >>>> Hi Lucian, >>>> >>>> no, local-hostname will provide only the hostname without the domain >>>> name (network name). >>>> But this is how it is documented in cloud-init: >>>> https://github.com/number5/cloud-init/blob/master/doc/examples/cloud >>>> - >>>> c >>>> onfig.txt >>>> line 433 - 439 >>>> >>>> But I need the whole fqdn. >>>> >>>> Mit freundlichen Grüßen / With kind regards, >>>> >>>> Swen >>>> >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: Nux! [mailto:n...@li.nux.ro] >>>> Gesendet: Freitag, 11. März 2016 11:22 >>>> An: users@cloudstack.apache.org; S. Brüseke - proIO GmbH >>>> Betreff: Re: cloud-init and user-data/meta-data >>>> >>>> Hi Swen, >>>> >>>> From that page: >>>> "local-hostname. The hostname of the VM" >>>> >>>> Isn't that what you need? >>>> >>>> Lucian >>>> >>>> -- >>>> Sent from the Delta quadrant using Borg technology! >>>> >>>> Nux! >>>> www.nux.ro >>>> >>>> ----- Original Message ----- >>>>> From: "S. Brüseke - proIO GmbH" <s.brues...@proio.com> >>>>> To: users@cloudstack.apache.org >>>>> Sent: Friday, 11 March, 2016 09:27:09 >>>>> Subject: cloud-init and user-data/meta-data >>>> >>>>> Hi to all, >>>>> >>>>> I am testing cloud-init in our CS installation. >>>>> >>>>> I want to recreate /etc/hosts on first boot so I use "manage_etc_hosts: >>>>> true". >>>>> The recreation works but it looks like the fqdn is not provided by CS. >>>>> As far as I understand cloud-init uses user-data/meta-data to get >>>>> all needed information. For fqdn it uses meta-data "hostname" >>>>> (https://github.com/number5/cloud-init/blob/master/doc/examples/clo >>>>> u >>>>> d >>>>> - >>>>> config.txt >>>>> line 441 - 445). >>>>> >>>>> Now my problem: CS do not provide "hostname" in meta-data. >>>>> (http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/virtual_machines.html#user-data-and-meta-data). >>>>> Where do I get the correct domain name from? >>>>> >>>>> Mit freundlichen Grüßen / With kind regards, >>>>> >>>>> Swen >>>>> >>>>> >>>>> >>>>> >>>>> - proIO GmbH - >>>>> Geschäftsführer: Swen Brüseke >>>>> Sitz der Gesellschaft: Frankfurt am Main >>>>> >>>>> USt-IdNr. DE 267 075 918 >>>>> Registergericht: Frankfurt am Main - HRB 86239 >>>>> >>>>> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte >>>>> Informationen. >>>>> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail >>>>> irrtümlich erhalten haben, informieren Sie bitte sofort den >>>>> Absender und vernichten Sie diese Mail. >>>>> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail >>>>> sind nicht gestattet. >>>>> >>>>> This e-mail may contain confidential and/or privileged information. >>>>> If you are not the intended recipient (or have received this e-mail >>>>> in >>>>> error) please notify the sender immediately and destroy this e-mail. >>>>> Any unauthorized copying, disclosure or distribution of the >>>>> material in this e-mail is strictly forbidden. >>>> >>>> >>>> - proIO GmbH - >>>> Geschäftsführer: Swen Brüseke >>>> Sitz der Gesellschaft: Frankfurt am Main >>>> >>>> USt-IdNr. DE 267 075 918 >>>> Registergericht: Frankfurt am Main - HRB 86239 >>>> >>>> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte >>>> Informationen. >>>> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail >>>> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender >>>> und vernichten Sie diese Mail. >>>> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail >>>> sind nicht gestattet. >>>> >>>> This e-mail may contain confidential and/or privileged information. >>>> If you are not the intended recipient (or have received this e-mail >>>> in >>>> error) please notify the sender immediately and destroy this e-mail. >>>> Any unauthorized copying, disclosure or distribution of the material >>>> in this e-mail is strictly forbidden. >>> >>> >>> - proIO GmbH - >>> Geschäftsführer: Swen Brüseke >>> Sitz der Gesellschaft: Frankfurt am Main >>> >>> USt-IdNr. DE 267 075 918 >>> Registergericht: Frankfurt am Main - HRB 86239 >>> >>> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte >>> Informationen. >>> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail >>> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender >>> und vernichten Sie diese Mail. >>> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail >>> sind nicht gestattet. >>> >>> This e-mail may contain confidential and/or privileged information. >>> If you are not the intended recipient (or have received this e-mail >>> in >>> error) please notify the sender immediately and destroy this e-mail. >>> Any unauthorized copying, disclosure or distribution of the material >>> in this e-mail is strictly forbidden. >> >> >> - proIO GmbH - >> Geschäftsführer: Swen Brüseke >> Sitz der Gesellschaft: Frankfurt am Main >> >> USt-IdNr. DE 267 075 918 >> Registergericht: Frankfurt am Main - HRB 86239 >> >> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte >> Informationen. >> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich >> erhalten haben, informieren Sie bitte sofort den Absender und >> vernichten Sie diese Mail. >> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail >> sind nicht gestattet. >> >> This e-mail may contain confidential and/or privileged information. >> If you are not the intended recipient (or have received this e-mail in >> error) please notify the sender immediately and destroy this e-mail. >> Any unauthorized copying, disclosure or distribution of the material >> in this e-mail is strictly forbidden. > > > - proIO GmbH - > Geschäftsführer: Swen Brüseke > Sitz der Gesellschaft: Frankfurt am Main > > USt-IdNr. DE 267 075 918 > Registergericht: Frankfurt am Main - HRB 86239 > > Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. > Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich > erhalten > haben, > informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. > Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht > gestattet. > > This e-mail may contain confidential and/or privileged information. > If you are not the intended recipient (or have received this e-mail in error) > please notify > the sender immediately and destroy this e-mail. > Any unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden.