Packer, Cloud-Init, and OpenStack

32 views
Skip to first unread message

Mark

unread,
Oct 23, 2018, 3:39:48 PM10/23/18
to Packer
All,

Trying to use packer to maintain our Linux OpenStack images.  We use cloud-init to lay down base configurations at deploy time and would like to move this process to a lower level and do it during image creation.  

As you can see below I am referencing an external file that has instructions for cloud-init.  This same methodology works perfectly in our Heat templates, however, in Heat we also have user_data_format set to RAW, which is NOT the default for OpenStack and not an acceptable parameter for packer. 

When using Packer the entire #cloud-config section is being ignored.

Is there a better way to pass cloud-init instructions during the image creation process?  


packer config .json contents
{
  "builders": [{
    "type": "openstack",
    "ssh_username": "centos",
    "image_name": "cent7-cloudinit",
    "source_image": "a4331a95-6741-4161-85a5-4e322c2a69bf",
    "flavor": "m1.small",
    "identity_endpoint": "http://x.x.x.x:5000/v3",
    "username": "",
    "password": "",
    "domain_name": "Default",
    "region": "RegionOne",
    "image_visibility": "public", 
    "networks": "78c8405e-e43c-46d1-b646-f513bf85eb9f",
    "floating_ip_network": "external_network",
    "user_data_file": "base.sh"
  }]
}

base.sh contents:

#cloud-config
yum_repos:
  salt-repo:
    name: SaltStack repo for Red Hat Enterprise Linux $releasever
    enabled: true
    gpgcheck: true

packages:
  - python-msgpack 
  - python-psutil 
  - python-zmq 
  - python-futures
  - zeromq 
  - libsodium 
  - systemd-python 
  - libtomcrypt 
  - libtommath
  - pciutils 
  - python-tornado 
  - python2-crypto
Reply all
Reply to author
Forward
0 new messages