May 26, 2016

Puppet use with OpenStack and cloudinit

Posted in OpenStack at 9:08 am by alessiodini

I finally was able to use HEAT templates writing inside puppet manifests.
With this method I can cover automatic installation and configuration of middleware products after the first boot og the instance. .

Following some line from my code ( be careful , pasting lines here destroys the yaml format )

server1:
type: OS::Nova::Server
properties:
name: test_01
image: { get_param: image_id }
flavor: m1.medium
networks:
– port: { get_resource: server1_port }
user_data_format: RAW
user_data:
get_resource: server_init

(…)

sys_init:
type: OS::Heat::SoftwareConfig
properties:
group: script
config: |
#!/bin/bash
setenforce 0
sed -i ‘s/SELINUX=enforcing/SELINUX=permissive/’ /etc/selinux/config
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
yum -y install puppet
puppet apply /tmp/01-setup.pp

(…)

setup_init:
type: OS::Heat::CloudConfig
properties:
cloud_config:
write_files:
– path: “/tmp/01-setup.pp”
permissions: ‘0666’
owner: root:root
content: |
class utilities {

package { ‘wget’:
ensure => ‘present’,
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: