ignite clone golden image /etc/hosts preserve

Tim Heckel
New Member

ignite clone golden image /etc/hosts preserve


We're running HPUX 11.11 and C.6.7.79 ignite.

Thank you for the related 28 Nov 05 post by Bob Vance.

We’ve been running make_sys_image at the default run level.

Our goal is to apply an identical image to up to 400 identical HP rp3410s. We have a golden image and can apply it, but have questions.

We would like to preserve our lengthy /etc/hosts file and apply it to the clones with only modification for hostname and IP.

Uncommenting "save_file /etc/nsswitch.conf" in our os_arch_post_l file does transfer the file to the clone. But the same process not preserve the /etc/hosts file. Even though it looks like it should according to our interpretation of the comments in the os_arch_post_l file, we get just the loopback address. We’ve tried save_file and merge_file but no luck. I see hosts in the excluded_files list, but not nsswitch.conf so apparently they are handled differently.

What is the best way to preserve the /etc/hosts file?

Mridul Shrivastava
Honored Contributor

Re: ignite clone golden image /etc/hosts preserve

while creating image try -x exclude option for /etc/hosts file, so this won't be included in image.
Time has a wonderful way of weeding out the trivial
Steven E. Protter
Exalted Contributor

Re: ignite clone golden image /etc/hosts preserve

Shalom Time,

Golden images excluded the /etc/hosts file when I last used it. Maybe I'm wrong.

There is a configuration file to list what files to include and exclude.


That link mentions this topic.

I'd also look into a post install script that copies the /etc/hosts file you want after the image is laid down. That would do the trick.

Steven E Protter
Owner of ISN Corporation
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Tim Heckel
New Member

Re: ignite clone golden image /etc/hosts preserve

Hi Mridul,
Please expand on your comment. We've read the man page for make_sys_image several times and see no way to include the /etc/hosts file, except setting run level at 1 and specifying the files to exclude.
Hi Steven,
We're unable to follow the link you provided. Can you double-check it and re-list if necessary?
Thanks to you both for your postings.
Best regards,
Scot Bean
Honored Contributor

Re: ignite clone golden image /etc/hosts preserve

Option 1:
Since you already have a golden image that you want to tweak, the easiest thing to do is tidy up the /etc/hosts file after ignite with a post_config_script. This is what I do.
- I have a simple script, say "fix_hosts", that I always run after ignite.
- I put this script in /var/opt/ignite/scripts/ on my Ignite server
- I use the syntax
post_config_script += "/var/opt/ignite/scripts/fix_hosts" in my config.local file to always run it

Option 2:
The make_sys_image command is a shell
script. You can make a copy of it, and make it your own via direct edits.

Take a look at the code, the LEVEL2_RESET variable defines the files that get blown away to make the clone/image generic. /etc/hosts is one of those. You could remove that line from a local copy to preserve the /etc/hosts file. However, I am not sure if the machine-specific /etc/hosts entries will be cleaned up at Ignite time. Could still be troublesome to get the right stuff in there.
Tim Heckel
New Member

Re: ignite clone golden image /etc/hosts preserve

Thank you Scot, that is exactly what I needed. I modified a copy of make_sys_image to include the files in the image, then modified my version of os_arch_post_l to save_file them. Best regards, Tim
Scot Bean
Honored Contributor

Re: ignite clone golden image /etc/hosts preserve

OK, but I would have used my own post ignite script rather than modifing the main ignite one.

Risks: watch out when you install a new version of ignite, it will blow away your edits.