Appendix B. Templates and Scripts

B.1. osphpe-deploy-overcloud.sh

#!/bin/bash -x
date
source stackrc
openstack overcloud deploy \
--templates \
-e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/monitoring-environment.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/logging-environment.yaml \
-e /home/stack/templates/mytemplates/extraParams.yaml \
--stack osphpe \
--debug \
--log-file overcloudDeploy.log \
--ceph-storage-flavor ceph-storage \
--ceph-storage-scale 3 \
--control-flavor control \
--control-scale 3 \
--compute-flavor compute \
--compute-scale 4 \
--block-storage-scale 0 \
--swift-storage-scale 0 \
--ntp-server 10.16.255.1
date

B.2. wipe-disks.yaml

heat_template_version: 2014-10-16
description: >
  Wipe and convert all disks to GPT (except the disk containing the root file system)
resources:
  userdata:
    type: OS::Heat::MultipartMime
    properties:
      parts:
      - config: {get_resource: wipe_disk}
  wipe_disk:
    type: OS::Heat::SoftwareConfig
    properties:
      config: {get_file: wipe-disk.sh}
outputs:
  OS::stack_id:
    value: {get_resource: userdataa}

B.3. wipe-disk.sh

#!/bin/bash
if [[ `hostname` = *"ceph"* ]]
then
  echo "Number of disks detected: $(lsblk -no NAME,TYPE,MOUNTPOINT | grep "disk" | awk '{print $1}' | wc -l)"
  for DEVICE in `lsblk -no NAME,TYPE,MOUNTPOINT | grep "disk" | awk '{print $1}'`
  do
    ROOTFOUND=0
    echo "Checking /dev/$DEVICE..."
    echo "Number of partitions on /dev/$DEVICE: $(expr $(lsblk -n /dev/$DEVICE | awk '{print $7}' | wc -l) - 1)"
    for MOUNTS in `lsblk -n /dev/$DEVICE | awk '{print $7}'`
    do
      if [ "$MOUNTS" = "/" ]
      then
        ROOTFOUND=1
      fi
    done
    if [ $ROOTFOUND = 0 ]
    then
      echo "Root not found in /dev/${DEVICE}"
      echo "Wiping disk /dev/${DEVICE}"
      sgdisk -Z /dev/${DEVICE}
      sgdisk -g /dev/${DEVICE}
    else
      echo "Root found in /dev/${DEVICE}"
    fi
  done
fi

B.4. undercloud.conf

undercloud_hostname = director.hpecloud.lab.eng.bos.redhat.com
local_ip = 192.168.20.20/24
network_gateway = 192.168.20.20
undercloud_public_vip = 192.168.20.2
undercloud_admin_vip = 192.168.20.3
undercloud_service_certificate = /etc/pki/instack-certs/undercloud.pem
local_interface = ens8
network_cidr = 192.168.20.0/24
masquerade_network = 192.168.20.0/24
dhcp_start = 192.168.20.50
dhcp_end = 192.168.20.99
inspection_interface = br-ctlplane
inspection_iprange = 192.168.20.100,192.168.20.120
inspection_runbench = false
undercloud_debug = true
enable_mistral = true
enable_zaqar = true
enable_ui = true
enable_validations = true
ipxe_deploy = true

B.5. extraParameter.yaml

resource_registry:
   OS::TripleO::Compute::Net::SoftwareConfig: /home/stack/templates/mytemplates/nic-configs/compute.yaml
   OS::TripleO::Controller::Net::SoftwareConfig: /home/stack/templates/mytemplates/nic-configs/controller.yaml
   OS::TripleO::CephStorage::Net::SoftwareConfig: /home/stack/templates/mytemplates/nic-configs/ceph-storage.yaml
   OS::TripleO::NodeUserData: /home/stack/templates/mytemplates/firstboot/wipe-disks.yaml
parameter_defaults:
  ControlPlaneSubnetCidr: "24"
  ControlPlaneDefaultRoute: 192.168.20.1
  EC2MetadataIp: 192.168.20.30
  DnsServers: ['10.11.5.19','8.8.8.8']
  # Customize all these values to match the local environment
  InternalApiNetCidr: 172.16.10.0/24
  StorageNetCidr: 172.16.6.0/24
  StorageMgmtNetCidr: 172.16.16.0/24
  TenantNetCidr: 172.16.160.0/24
  ExternalNetCidr: 10.19.20.128/25
  InternalApiAllocationPools: [{'start': '172.16.10.100', 'end': '172.16.10.200'}]
  StorageAllocationPools: [{'start': '172.16.6.10', 'end': '172.16.6.200'}]
  StorageMgmtAllocationPools: [{'start': '172.16.16.10', 'end': '172.16.16.200'}]
  TenantAllocationPools: [{'start': '172.16.160.10', 'end': '172.16.160.200'}]
  # Use an External allocation pool which will leave room for floating IPs
  ExternalAllocationPools: [{'start': '10.19.20.150', 'end': '10.19.20.175'}]
  InternalApiNetworkVlanID: 3041
  StorageNetworkVlanID: 3042
  StorageMgmtNetworkVlanID: 3043
  TenantNetworkVlanID: 3044
  ExternalNetworkVlanID: 104
  # Set to the router gateway on the external network
  ExternalInterfaceDefaultRoute: 10.19.20.254
  # Customize bonding options if required (will be ignored if bonds are not used)
  BondInterfaceOvsOptions: 'balance-slb lacp=off'
  NeutronExternalNetworkBridge: "''"
  NeutronBridgeMappings: "datacentre:br-ex"
  NeutronNetworkVLANRanges: 'datacentre:1:1000'
  NeutronTunnelTypes: 'vxlan'
  TimeZone: 'US/Eastern'
  #Monitoring Parameters
  MonitoringRabbitHost: 192.168.20.201
  MonitoringRabbitPort: 5672
  MonitoringRabbitUserName: sensu
  MonitoringRabbitPassword: sensu
  MonitoringRabbitUseSSL: false
  MonitoringRabbitVhost: "/sensu"
  #Logging
  LoggingServers:
    - host: 192.168.20.202
      port: 24224
  parameter_defaults:
  ExtraConfig:
    ceph::profile::params::osd_journal_size: 5120
    ceph::profile::params::osds:
        '/dev/sdb':
          journal: '/dev/sdl1'
        '/dev/sdc':
          journal: '/dev/sdm1'
        '/dev/sdd':
          journal: '/dev/sdl2'
        '/dev/sde':
          journal: '/dev/sdm2'
        '/dev/sdf':
          journal: '/dev/sdl3'
        '/dev/sdg':
          journal: '/dev/sdm3'
        '/dev/sdh':
          journal: '/dev/sdl4'
        '/dev/sdi':
          journal: '/dev/sdm4'
        '/dev/sdj':
          journal: '/dev/sdl5'
        '/dev/sdk':
          journal: '/dev/sdm5'

B.6. compute.yaml

heat_template_version: 2015-04-30
description: >
  Software Config to drive os-net-config with 2 bonded nics on a bridge
  with VLANs attached for the compute role.
parameters:
  ControlPlaneIp:
    default: ''
    description: IP address/subnet on the ctlplane network
    type: string
  ExternalIpSubnet:
    default: ''
    description: IP address/subnet on the external network
    type: string
  InternalApiIpSubnet:
    default: ''
    description: IP address/subnet on the internal API network
    type: string
  StorageIpSubnet:
    default: ''
    description: IP address/subnet on the storage network
    type: string
  StorageMgmtIpSubnet:
    default: ''
    description: IP address/subnet on the storage mgmt network
    type: string
  TenantIpSubnet:
    default: ''
    description: IP address/subnet on the tenant network
    type: string
  ManagementIpSubnet: # Only populated when including environments/network-management.yaml
    default: ''
    description: IP address/subnet on the management network
    type: string
  BondInterfaceOvsOptions:
    default: ''
    description: The ovs_options string for the bond interface. Set things like
                 lacp=active and/or bond_mode=balance-slb using this option.
    type: string
  InternalApiNetworkVlanID:
    default: 0
    description: Vlan ID for the internal_api network traffic.
    type: number
  StorageNetworkVlanID:
    default: 3042
    description: Vlan ID for the storage network traffic.
    type: number
  TenantNetworkVlanID:
    default: 0
    description: Vlan ID for the tenant network traffic.
    type: number
  ManagementNetworkVlanID:
    default: 0
    description: Vlan ID for the management network traffic.
    type: number
  ControlPlaneSubnetCidr: # Override this via parameter_defaults
    default: '24'
    description: The subnet CIDR of the control plane network.
    type: string
  ControlPlaneDefaultRoute: # Override this via parameter_defaults
    description: The default route of the control plane network.
    type: string
  DnsServers: # Override this via parameter_defaults
    default: []
    description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
    type: comma_delimited_list
  EC2MetadataIp: # Override this via parameter_defaults
    description: The IP address of the EC2 metadata server.
    type: string
resources:
  OsNetConfigImpl:
    type: OS::Heat::StructuredConfig
    properties:
      group: os-apply-config
      config:
        os_net_config:
          network_config:
            -
              type: interface
              name: eno1
              use_dhcp: false
              dns_servers: {get_param: DnsServers}
              addresses:
                -
                  ip_netmask:
                    list_join:
                      - '/'
                      - - {get_param: ControlPlaneIp}
                        - {get_param: ControlPlaneSubnetCidr}
              routes:
                -
                  ip_netmask: 169.254.169.254/32
                  next_hop: {get_param: EC2MetadataIp}
                -
                  default: true
                  next_hop: {get_param: ControlPlaneDefaultRoute}
            -
              type: ovs_bridge
              name: {get_input: bridge_name}
              dns_servers: {get_param: DnsServers}
              members:
                -
                  type: ovs_bond
                  name: bond0
                  bonding_options: {get_param: BondInterfaceOvsOptions}
                  members:
                    -
                      type: interface
                      name: eno49
                      primary: true
                    -
                      type: interface
                      name: ens2f0
                -
                  type: vlan
                  device: bond0
                  vlan_id: {get_param: InternalApiNetworkVlanID}
                  addresses:
                    -
                     ip_netmask: {get_param: InternalApiIpSubnet}
                -
                  type: vlan
                  device: bond0
                  vlan_id: {get_param: TenantNetworkVlanID}
                  addresses:
                    -
                     ip_netmask: {get_param: TenantIpSubnet}
            -
              type: ovs_bridge
              name: br_storage
              dns_servers: {get_param: DnsServers}
              members:
                -
                  type: ovs_bond
                  name: bond1
                  bonding_options: {get_param: BondInterfaceOvsOptions}
                  members:
                    -
                      type: interface
                      name: eno50
                      primary: true
                      mtu: 9000
                    -
                      type: interface
                      name: ens2f1
                      mtu: 9000
                -
                  type: vlan
                  mtu: 9000
                  device: bond1
                  vlan_id: {get_param: StorageNetworkVlanID}
                  addresses:
                    -
                     ip_netmask: {get_param: StorageIpSubnet}
            -
              type: interface
              name: eno2
              use_dhcp: false
              defroute: false
            -
              type: interface
              name: eno3
              use_dhcp: false
              defroute: false
            -
              type: interface
              name: eno4
              use_dhcp: false
              defroute: false
outputs:
  OS::stack_id:
    description: The OsNetConfigImpl resource.
    value: {get_resource: OsNetConfigImpl}

B.7. controller.yaml

heat_template_version: 2015-04-30
description: >
  Software Config to drive os-net-config with 2 bonded nics on a bridge
  with VLANs attached for the controller role.
parameters:
  ControlPlaneIp:
    default: ''
    description: IP address/subnet on the ctlplane network
    type: string
  ExternalIpSubnet:
    default: ''
    description: IP address/subnet on the external network
    type: string
  InternalApiIpSubnet:
    default: ''
    description: IP address/subnet on the internal API network
    type: string
  StorageIpSubnet:
    default: ''
    description: IP address/subnet on the storage network
    type: string
  StorageMgmtIpSubnet:
    default: ''
    description: IP address/subnet on the storage mgmt network
    type: string
  TenantIpSubnet:
    default: ''
    description: IP address/subnet on the tenant network
    type: string
  ManagementIpSubnet: # Only populated when including environments/network-management.yaml
    default: ''
    description: IP address/subnet on the management network
    type: string
  BondInterfaceOvsOptions:
    default: ''
    description: The ovs_options string for the bond interface. Set things like
                 lacp=active and/or bond_mode=balance-slb using this option.
    type: string
  ExternalNetworkVlanID:
    default: 0
    description: Vlan ID for the external network traffic.
    type: number
  InternalApiNetworkVlanID:
    default: 0
    description: Vlan ID for the internal_api network traffic.
    type: number
  StorageNetworkVlanID:
    default: 0
    description: Vlan ID for the storage network traffic.
    type: number
  StorageMgmtNetworkVlanID:
    default: 3042
    description: Vlan ID for the storage mgmt network traffic.
    type: number
  TenantNetworkVlanID:
    default: 0
    description: Vlan ID for the tenant network traffic.
    type: number
  ManagementNetworkVlanID:
    default: 0
    description: Vlan ID for the management network traffic.
    type: number
  ExternalInterfaceDefaultRoute:
    default: '10.0.0.1'
    description: default route for the external network
    type: string
  ControlPlaneSubnetCidr: # Override this via parameter_defaults
    default: '24'
    description: The subnet CIDR of the control plane network.
    type: string
  DnsServers: # Override this via parameter_defaults
    default: []
    description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
    type: comma_delimited_list
  EC2MetadataIp: # Override this via parameter_defaults
    description: The IP address of the EC2 metadata server.
    type: string
resources:
  OsNetConfigImpl:
    type: OS::Heat::StructuredConfig
    properties:
      group: os-apply-config
      config:
        os_net_config:
          network_config:
            -
              type: interface
              name: eno1
              use_dhcp: false
              addresses:
                -
                  ip_netmask:
                    list_join:
                      - '/'
                      - - {get_param: ControlPlaneIp}
                        - {get_param: ControlPlaneSubnetCidr}
              routes:
                -
                  ip_netmask: 169.254.169.254/32
                  next_hop: {get_param: EC2MetadataIp}
            -
             type: ovs_bridge
             name: {get_input: bridge_name}
             dns_servers: {get_param: DnsServers}
             members:
               -
                type: ovs_bond
                name: bond0
                bonding_options: {get_param: BondInterfaceOvsOptions}
                members:
                  -
                   type: interface
                   name: eno49
                   mtu: 9000
                   primary: true
                  -
                   type: interface
                   name: ens2f0
                   mtu: 9000
               -
                type: vlan
                device: bond0
                vlan_id: {get_param: ExternalNetworkVlanID}
                addresses:
                  -
                   ip_netmask: {get_param: ExternalIpSubnet}
                routes:
                  -
                   default: true
                   next_hop: {get_param: ExternalInterfaceDefaultRoute}
               -
                type: vlan
                device: bond0
                vlan_id: {get_param: InternalApiNetworkVlanID}
                addresses:
                  -
                   ip_netmask: {get_param: InternalApiIpSubnet}
               -
                type: vlan
                device: bond0
                vlan_id: {get_param: TenantNetworkVlanID}
                addresses:
                  -
                   ip_netmask: {get_param: TenantIpSubnet}
               -
                type: vlan
                device: bond0
                mtu: 9000
                vlan_id: {get_param: StorageMgmtNetworkVlanID}
                addresses:
                  -
                   ip_netmask: {get_param: StorageMgmtIpSubnet}
            -
             type: ovs_bridge
             name: br_storage
             dns_servers: {get_param: DnsServers}
             members:
               -
                type: ovs_bond
                name: bond1
                bonding_options: {get_param: BondInterfaceOvsOptions}
                members:
                  -
                   type: interface
                   name: eno50
                   primary: true
                   mtu: 9000
                  -
                   type: interface
                   name: ens2f1
                   mtu: 9000
               -
                type: vlan
                device: bond1
                mtu: 9000
                vlan_id: {get_param: StorageNetworkVlanID}
                addresses:
                  -
                   ip_netmask: {get_param: StorageIpSubnet}
            -
             type: interface
             name: eno2
             use_dhcp: false
             defroute: false
            -
             type: interface
             name: eno3
             use_dhcp: false
             defroute: false
            -
             type: interface
             name: eno4
             use_dhcp: false
             defroute: false
outputs:
  OS::stack_id:
    description: The OsNetConfigImpl resource.
    value: {get_resource: OsNetConfigImpl}

B.8. ceph-storage.yaml

heat_template_version: 2015-04-30
description: >
  Software Config to drive os-net-config with 2 bonded nics on a bridge
  with VLANs attached for the ceph storage role.
parameters:
  ControlPlaneIp:
    default: ''
    description: IP address/subnet on the ctlplane network
    type: string
  ExternalIpSubnet:
    default: ''
    description: IP address/subnet on the external network
    type: string
  InternalApiIpSubnet:
    default: ''
    description: IP address/subnet on the internal API network
    type: string
  StorageIpSubnet:
    default: ''
    description: IP address/subnet on the storage network
    type: string
  StorageMgmtIpSubnet:
    default: ''
    description: IP address/subnet on the storage mgmt network
    type: string
  TenantIpSubnet:
    default: ''
    description: IP address/subnet on the tenant network
    type: string
  ManagementIpSubnet: # Only populated when including environments/network-management.yaml
    default: ''
    description: IP address/subnet on the management network
    type: string
  BondInterfaceOvsOptions:
    default: ''
    description: The ovs_options string for the bond interface. Set things like
                 lacp=active and/or bond_mode=balance-slb using this option.
    type: string
    constraints:
      - allowed_pattern: "^((?!balance.tcp).)*$"
        description: |
          The balance-tcp bond mode is known to cause packet loss and
          should not be used in BondInterfaceOvsOptions.
  ExternalNetworkVlanID:
    default: 0
    description: Vlan ID for the external network traffic.
    type: number
  InternalApiNetworkVlanID:
    default: 0
    description: Vlan ID for the internal_api network traffic.
    type: number
  StorageNetworkVlanID:
    default: 3042
    description: Vlan ID for the storage network traffic.
    type: number
  StorageMgmtNetworkVlanID:
    default: 0
    description: Vlan ID for the storage mgmt network traffic.
    type: number
  TenantNetworkVlanID:
    default: 0
    description: Vlan ID for the tenant network traffic.
    type: number
  ManagementNetworkVlanID:
    default: 0
    description: Vlan ID for the management network traffic.
    type: number
  ControlPlaneSubnetCidr: # Override this via parameter_defaults
    default: '24'
    description: The subnet CIDR of the control plane network.
    type: string
  ControlPlaneDefaultRoute: # Override this via parameter_defaults
    description: The default route of the control plane network.
    type: string
  ExternalInterfaceDefaultRoute: # Not used by default in this template
    default: '10.0.0.1'
    description: The default route of the external network.
    type: string
  ManagementInterfaceDefaultRoute: # Commented out by default in this template
    default: unset
    description: The default route of the management network.
    type: string
  DnsServers: # Override this via parameter_defaults
    default: []
    description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
    type: comma_delimited_list
  EC2MetadataIp: # Override this via parameter_defaults
    description: The IP address of the EC2 metadata server.
    type: string
resources:
  OsNetConfigImpl:
    type: OS::Heat::StructuredConfig
    properties:
      group: os-apply-config
      config:
        os_net_config:
          network_config:
            -
              type: interface
              name: eno1
              use_dhcp: false
              dns_servers: {get_param: DnsServers}
              addresses:
                -
                  ip_netmask:
                    list_join:
                      - '/'
                      - - {get_param: ControlPlaneIp}
                        - {get_param: ControlPlaneSubnetCidr}
              routes:
                -
                  ip_netmask: 169.254.169.254/32
                  next_hop: {get_param: EC2MetadataIp}
                -
                  default: true
                  next_hop: {get_param: ControlPlaneDefaultRoute}
            -
              type: ovs_bridge
              name: br_storage_mgmt
              dns_servers: {get_param: DnsServers}
              members:
                -
                 type: ovs_bond
                 name: bond0
                 bonding_options: {get_param: BondInterfaceOvsOptions}
                 members:
                   -
                    type: interface
                    name: eno49
                    primary: true
                    mtu: 9000
                   -
                    type: interface
                    name: ens1f0
                    mtu: 9000
                -
                 type: vlan
                 device: bond0
                 mtu: 9000
                 vlan_id: {get_param: StorageMgmtNetworkVlanID}
                 addresses:
                   -
                     ip_netmask: {get_param: StorageMgmtIpSubnet}
            -
              type: ovs_bridge
              name: br_storage
              dns_servers: {get_param: DnsServers}
              members:
                -
                 type: ovs_bond
                 name: bond1
                 bonding_options: {get_param: BondInterfaceOvsOptions}
                 members:
                   -
                    type: interface
                    name: eno50
                    primary: true
                    mtu: 9000
                   -
                    type: interface
                    name: ens1f1
                    mtu: 9000
                -
                 type: vlan
                 device: bond1
                 mtu: 9000
                 vlan_id: {get_param: StorageNetworkVlanID}
                 addresses:
                   -
                    ip_netmask: {get_param: StorageIpSubnet}
            -
              type: interface
              name: eno2
              use_dhcp: false
              defroute: false
            -
              type: interface
              name: eno3
              use_dhcp: false
              defroute: false
            -
              type: interface
              name: eno4
              use_dhcp: false
              defroute: false
outputs:
  OS::stack_id:
    description: The OsNetConfigImpl resource.
    value: {get_resource: OsNetConfigImpl}

B.9. instackenv.json

{
    "nodes":[
        {
            "pm_type":"pxe_ilo",
            "mac":[
                "94:18:82:08:81:18"
            ],
            "capabilities": "profile:compute,boot_option:local",
            "cpu":"2",
            "memory":"4096",
            "disk":"146",
            "arch":"x86_64",
            "pm_user":"root",
            "pm_password":"redhat",
            "pm_addr":"10.19.20.132"
        },
        {
            "pm_type":"pxe_ilo",
            "mac":[
                "94:18:82:08:81:20"
            ],
            "capabilities": "profile:compute,boot_option:local",
            "cpu":"2",
            "memory":"4096",
            "disk":"146",
            "arch":"x86_64",
            "pm_user":"root",
            "pm_password":"redhat",
            "pm_addr":"10.19.20.133"
        },
        {
            "pm_type":"pxe_ilo",
            "mac":[
                "94:18:82:08:71:b4"
            ],
            "capabilities": "profile:compute,boot_option:local",
            "cpu":"2",
            "memory":"4096",
            "disk":"146",
            "arch":"x86_64",
            "pm_user":"root",
            "pm_password":"redhat",
            "pm_addr":"10.19.20.134"
        },
        {
            "pm_type":"pxe_ilo",
            "mac":[
                "94:18:82:08:71:9c"
            ],
            "capabilities": "profile:compute,boot_option:local",
            "cpu":"2",
            "memory":"4096",
            "disk":"146",
            "arch":"x86_64",
            "pm_user":"root",
            "pm_password":"redhat",
            "pm_addr":"10.19.20.135"
        },
        {
            "pm_type":"pxe_ilo",
            "mac":[
                 "94:18:82:08:81:48"
            ],
            "capabilities": "profile:control,boot_option:local",
            "cpu":"2",
            "memory":"4096",
            "disk":"146",
            "arch":"x86_64",
            "pm_user":"root",
            "pm_password":"redhat",
            "pm_addr":"10.19.20.136"
        },
        {
            "pm_type":"pxe_ilo",
            "mac":[
                 "e0:07:1b:f2:93:ec"
            ],
            "capabilities": "profile:control,boot_option:local",
            "cpu":"2",
            "memory":"4096",
            "disk":"146",
            "arch":"x86_64",
            "pm_user":"root",
            "pm_password":"redhat",
            "pm_addr":"10.19.20.137"
        },
        {
            "pm_type":"pxe_ilo",
            "mac":[
                 "94:18:82:08:71:90"
            ],
            "capabilities": "profile:control,boot_option:local",
            "cpu":"2",
            "memory":"4096",
            "disk":"146",
            "arch":"x86_64",
            "pm_user":"root",
            "pm_password":"redhat",
            "pm_addr":"10.19.20.138"
        },
        {
           "pm_type":"pxe_ilo",
           "mac":[
                "94:18:82:08:f0:14"
           ],
           "capabilities": "profile:ceph-storage,boot_option:local",
           "cpu":"2",
           "memory":"4096",
           "disk":"146",
           "arch":"x86_64",
           "pm_user":"root",
           "pm_password":"redhat",
           "pm_addr":"10.19.20.140"
        },
        {
           "pm_type":"pxe_ilo",
           "mac":[
                "e0:07:1b:f2:53:98"
           ],
           "capabilities": "profile:ceph-storage,boot_option:local",
           "cpu":"2",
           "memory":"4096",
           "disk":"146",
           "arch":"x86_64",
           "pm_user":"root",
           "pm_password":"redhat",
           "pm_addr":"10.19.20.141"
       },
       {
           "pm_type":"pxe_ilo",
           "mac":[
                "e0:07:1b:f6:fd:44"
           ],
           "capabilities": "profile:ceph-storage,boot_option:local",
           "cpu":"2",
           "memory":"4096",
           "disk":"146",
           "arch":"x86_64",
           "pm_user":"root",
           "pm_password":"redhat",
           "pm_addr":"10.19.20.142"
       }
    ]
}

B.10. Heat Template for Instance Deployment

heat_template_version: 2015-04-30
description: Template that installs a server with a RHN subscription
parameters:
  image:
    type: string
    label: Image name or ID
    description: Image to be used for server.
    default: rhel7
  flavor:
    type: string
    label: Flavor
    description: Type of instance (flavor) to be used on the compute instance.
    default: m1.small
  key:
    type: string
    label: Key name
    description: Name of key-pair to be installed on the compute instance.
    default: hpeuserkp
  private_network:
    type: string
    label: Private network name or ID
    description: Network to attach server to.
    default: net1
  rhn_user:
    type: string
    label: rhn username
    description: Name of the rhn user.
  rhn_password:
    type: string
    label: RHN user password
    description: rhn user password
    hidden: true
  rhn_hostname:
    type: string
    label: instance hostname
    description: FQDN host name for instance
  rhn_pool:
    type: string
    label: rhn pool ID
    description: rhn pool ID
resources:
   floating_ip:
    type: OS::Nova::FloatingIP
    properties:
      pool: nova
   association:
    type: OS::Nova::FloatingIPAssociation
    properties:
      floating_ip: { get_resource: floating_ip }
      server_id: { get_resource: rhn_instance }
   rhn_instance:
    type: OS::Nova::Server
    properties:
     image: { get_param: image }
     flavor: { get_param: flavor }
     key_name: { get_param: key }
     networks:
          - network: { get_param: private_network }
     user_data_format: RAW
     user_data:
       str_replace:
         params:
          __rhn_username__: { get_param: rhn_user }
          __rhn_password__: { get_param: rhn_password }
          __rhn_hostname__: { get_param: rhn_hostname }
          __rhn_pool__: { get_param: rhn_pool }
         template: |
           #!/bin/bash -ex
            subscription-manager register --username __rhn_username__ --password __rhn_password__
            subscription-manager attach --pool=__rhn_pool__
            subscription-manager repos --disable=*
            subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-rh-common-rpms
            echo '[sensu]
           name=sensu
           baseurl=http://repositories.sensuapp.org/yum/$basearch/
           gpgcheck=0
           enabled=1' | tee /etc/yum.repos.d/sensu.repo
            yum update -y
            yum install sensu -y
            rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
            yum install epel-release -y
            yum install wget -y
            wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
            rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
            yum install -y erlang
            yum install -y socat
            rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.3/rabbitmq-server-3.6.3-1.noarch.rpm
            chkconfig rabbitmq-server on
            service rabbitmq-server start
            rabbitmqctl add_vhost /sensu
            rabbitmqctl add_user sensu secret
            rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"
            yum install ansible -y
            yum install git -y
            hostnamectl set-hostname __rhn_hostname__
            echo '{
              "client": {
                "name": "localhost",
                "address": "127.0.0.1",
                "subscriptions": [
                  "test"
                ]
              }
            }' | tee /etc/sensu/conf.d/client.json
            echo '{
             "rabbitmq": {
               "port": 5672,
               "host": "10.19.20.200",
               "user": "sensu",
               "password": "sensu",
               "vhost": "/sensu",
               "reconnect_on_error": false,
               "prefetch": 1
             }
           }' | tee /etc/sensu/conf.d/rabbitmq.json
             echo  '{
             "transport": {
               "name": "rabbitmq",
               "reconnect_on_error": true
             }
           }' | tee /etc/sensu/conf.d/transport.json
            git clone https://github.com/kj1bell/ansible_scripts.git
            ansible-playbook -i "localhost," -c local ./ansible_scripts/sensu.yaml
outputs:
  instance_ip:
    description: IP address of the deployed compute instance
    value: { get_attr: [rhn_instance, first_address] }
# notify heat that we are done here
#
# openstack stack create -t /templates/mytemplates/inst.yaml --parameter "rhn_user=<your-rhn-user>;rhn_password=<your-rhn-password>;rhn_pool=<rhn-subscription-pool-id>;rhn_hostname=<FQDN for instance>" rhninst

B.11. Ansible Script to Configure Sensu Client

---
- hosts: all
  tasks:
     - name: replace ip
       replace:
         dest: /etc/sensu/conf.d/client.json
         regexp: "127.0.0.1"
         replace: "{{ ansible_eth0.ipv4.address }}"
         backup: no
     - name: replace hostname
       replace:
         dest: /etc/sensu/conf.d/client.json
         regexp: "localhost"
         replace: "{{ ansible_fqdn }}"
         backup: no
     - name: start Sensu Client
       shell: systemctl start sensu-client

B.12. Director Interfaces

ens3

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
NAME=ens3
UUID=39bee618-ff0a-41a4-833d-e7b7f8a9ea48
DEVICE=ens3
ONBOOT=yes
IPADDR=10.19.20.220
GATEWAY=10.19.20.254
NETMASK=255.255.255.128
DNS1=10.5.30.160
DNS2=10.11.5.19

ens4

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=no
PEERDNS=yes
IPV4_FAILURE_FATAL=no
NAME=ens4
UUID=8952a60f-3d58-462e-8a7c-aa61b77a7f9e
DEVICE=ens4
ONBOOT=yes
IPADDR=192.168.20.30
NETMASK=255.255.255.0