cloud-init and salt-minion hostname setting

386 views
Skip to first unread message

Shane Gibson

unread,
Jun 15, 2016, 6:21:58 PM6/15/16
to Salt-users

All - I have what I hope is a simple question.  I'm using cloud-init under an OpenStack cloud environment, to set the salt-minion master parameter.  

By default my guest/instance has a hostname of 'ubuntu'.  Cloud-init makes the correct changes to alter the hostname as defined by the user on creation of the instance.  For example; "ubuntu-salt-minion-test-v3".

However, the default salt-minion start up of the instance wires the /etc/salt/minion_id with "ubuntu".  My assumption is that salt-minion is simply running *prior* to the cloud-init service setting the hostname of the instance.  I'm not certain how to most efficiently/correctly force the behavior of cloud-init and the salt-minion to "do the right thing" by setting the minion_id correctly to the new hostname. 

My goal is to be able to set the hostname via the injected metadata - and have the salt-minion plumb up with the correct "minion_id". 

Any feedback or suggestions greatly appreciated.   My (very basic) cloud-init snippet is below for reference. 

~~shane 

#cloud-config
users
:
   
- default
disable_root
: true
preserve_hostname
: false
cloud_init_modules
:
 
- update_hostname
 
- <...snip...>
cloud_config_modules
:
 
- salt-minion
 
- <...snip...>
cloud_final_modules
:
 
- <...snip...>
resize_rootfs
: true
manage_etc_hosts
: localhost
system_info
:
   distro
: ubuntu
   default_user
:
     name
: ubuntu
       
<...snip...>
   paths
:
      cloud_dir
: /var/lib/cloud/
      templates_dir
: /etc/cloud/templates/
      upstart_dir
: /etc/init/
   package_mirrors
:
       
<...snip...>
   ssh_svcname
: ssh
package_update
: false
package_upgrade
: false
salt_minion
:
   conf
:
     master
: <saltmaster_fqdn>

Reply all
Reply to author
Forward
0 new messages