Puppet Class: openstack::nova::api::service

Defined in:
modules/openstack/manifests/nova/api/service.pp

Overview

This is the api service for Openstack Nova. It provides a REST api that Wikitech and Horizon use to manage VMs.

Parameters:

  • version (Any)
  • active (Any)
  • api_bind_port (Stdlib::Port)
  • metadata_bind_port (Stdlib::Port)
  • dhcp_domain (String)


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'modules/openstack/manifests/nova/api/service.pp', line 3

class openstack::nova::api::service(
    $version,
    $active,
    Stdlib::Port $api_bind_port,
    Stdlib::Port $metadata_bind_port,
    String       $dhcp_domain,
    ) {

    class { "openstack::nova::api::service::${version}":
        api_bind_port      => $api_bind_port,
        metadata_bind_port => $metadata_bind_port,
    }

    service { 'nova-api':
        ensure    => $active,
        subscribe => [
                      File['/etc/nova/nova.conf'],
                      File['/etc/nova/policy.yaml'],
                      File['/etc/nova/vendor_data.json'],
            ],
        require   => Package['nova-api'];
    }

    # vendor data needs to be in json format. vendordata.txt
    #  contains all of our cloud-init settings and firstboot script;
    #  jamming it all into one giant json field seems to work.
    $vendordata_file_contents = template('openstack/nova/vendordata.txt.erb')
    $vendor_data = {
        'domain'     => $dhcp_domain,
        'cloud-init' => $vendordata_file_contents,
    }

    file { '/etc/nova/vendor_data.json':
        content => to_json_pretty($vendor_data),
        owner   => 'nova',
        group   => 'nogroup',
        mode    => '0444',
        require => Package['nova-common'],
        notify  => Service['nova-api-metadata', 'nova-api'];
    }
}