Merge "Don't rely on lsb_release for hosts template write"
authorJenkins <jenkins@review.openstack.org>
Tue, 13 Dec 2016 14:36:20 +0000 (14:36 +0000)
committerGerrit Code Review <review@openstack.org>
Tue, 13 Dec 2016 14:36:20 +0000 (14:36 +0000)
network/config/multiple-nics/compute-dvr.yaml [new file with mode: 0644]
puppet/extraconfig/tls/freeipa-enroll.yaml [new file with mode: 0644]

diff --git a/network/config/multiple-nics/compute-dvr.yaml b/network/config/multiple-nics/compute-dvr.yaml
new file mode 100644 (file)
index 0000000..db9b491
--- /dev/null
@@ -0,0 +1,162 @@
+heat_template_version: '2016-10-14'
+description: >
+  Software Config to drive os-net-config to configure multiple interfaces for the
+  compute role with external bridge for DVR.
+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
+  ExternalNetworkVlanID:
+    default: 10
+    description: Vlan ID for the external network traffic.
+    type: number
+  InternalApiNetworkVlanID:
+    default: 20
+    description: Vlan ID for the internal_api network traffic.
+    type: number
+  StorageNetworkVlanID:
+    default: 30
+    description: Vlan ID for the storage network traffic.
+    type: number
+  StorageMgmtNetworkVlanID:
+    default: 40
+    description: Vlan ID for the storage mgmt network traffic.
+    type: number
+  TenantNetworkVlanID:
+    default: 50
+    description: Vlan ID for the tenant network traffic.
+    type: number
+  ManagementNetworkVlanID:
+    default: 60
+    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::SoftwareConfig
+    properties:
+      group: script
+      config:
+        str_replace:
+          template:
+            get_file: ../../scripts/run-os-net-config.sh
+          params:
+            $network_config:
+              network_config:
+              - type: interface
+                name: nic1
+                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: interface
+                name: nic2
+                use_dhcp: false
+                addresses:
+                - ip_netmask:
+                    get_param: StorageIpSubnet
+              - type: interface
+                name: nic4
+                use_dhcp: false
+                addresses:
+                - ip_netmask:
+                    get_param: InternalApiIpSubnet
+              - type: ovs_bridge
+                name: br-tenant
+                use_dhcp: false
+                addresses:
+                - ip_netmask:
+                    get_param: TenantIpSubnet
+                members:
+                - type: interface
+                  name: nic5
+                  use_dhcp: false
+                  primary: true
+              # External bridge for DVR (no IP address required)
+              - type: ovs_bridge
+                name: bridge_name
+                dns_servers:
+                  get_param: DnsServers
+                use_dhcp: false
+                members:
+                - type: interface
+                  name: nic6
+                  primary: true
+            # Uncomment when including environments/network-management.yaml
+            # If setting default route on the Management interface, comment
+            # out the default route on the Control Plane.
+            #-
+            #  type: interface
+            #  name: nic7
+            #  use_dhcp: false
+            #  addresses:
+            #    -
+            #      ip_netmask: {get_param: ManagementIpSubnet}
+            #  routes:
+            #    -
+            #      default: true
+            #      next_hop: {get_param: ManagementInterfaceDefaultRoute}
+outputs:
+  OS::stack_id:
+    description: The OsNetConfigImpl resource.
+    value:
+      get_resource: OsNetConfigImpl
+
diff --git a/puppet/extraconfig/tls/freeipa-enroll.yaml b/puppet/extraconfig/tls/freeipa-enroll.yaml
new file mode 100644 (file)
index 0000000..44be7c6
--- /dev/null
@@ -0,0 +1,72 @@
+heat_template_version: 2015-10-15
+
+description: Enroll nodes to FreeIPA
+
+parameters:
+  server:
+    description: ID of the controller node to apply this config to
+    type: string
+
+  CloudDomain:
+    description: >
+      The configured cloud domain; this will also be used as the kerberos realm
+    type: string
+
+  FreeIPAOTP:
+    description: 'OTP that will be used for FreeIPA enrollment'
+    type: string
+    hidden: true
+  FreeIPAServer:
+    description: 'FreeIPA server DNS name'
+    type: string
+  FreeIPAIPAddress:
+    default: ''
+    description: 'FreeIPA server IP Address'
+    type: string
+
+resources:
+  FreeIPAEnrollmentConfig:
+    type: OS::Heat::SoftwareConfig
+    properties:
+      group: script
+      inputs:
+        - name: otp
+        - name: ipa_server
+        - name: ipa_domain
+        - name: ipa_ip
+      config: |
+        #!/bin/sh
+        sed -i "/${ipa_server}/d" /etc/hosts
+        # Optionally add the FreeIPA server IP to /etc/hosts
+        if [ -n "${ipa_ip}" ]; then
+            echo "${ipa_ip}    ${ipa_server}" >> /etc/hosts
+        fi
+        # Set the node's domain if needed
+        if [ ! $(hostname -f | grep "${ipa_domain}$") ]; then
+            hostnamectl set-hostname "$(hostname).${ipa_domain}"
+        fi
+        yum install -y ipa-client
+        # Enroll. If there is already keytab, we have already done this.
+        if [ ! -f /etc/krb5.keytab ]; then
+            ipa-client-install --server ${ipa_server} -w ${otp} \
+                --domain=${ipa_domain} -U
+        fi
+        # Get a TGT
+        kinit -k -t /etc/krb5.keytab
+
+  FreeIPAControllerEnrollmentDeployment:
+    type: OS::Heat::SoftwareDeployment
+    properties:
+      name: FreeIPAEnrollmentDeployment
+      config: {get_resource: FreeIPAEnrollmentConfig}
+      server: {get_param: server}
+      input_values:
+        otp: {get_param: FreeIPAOTP}
+        ipa_server: {get_param: FreeIPAServer}
+        ipa_domain: {get_param: CloudDomain}
+        ipa_ip: {get_param: FreeIPAIPAddress}
+
+outputs:
+  deploy_stdout:
+    description: Output of the FreeIPA enrollment deployment
+    value: {get_attr: [FreeIPAControllerEnrollmentDeployment, deploy_stdout]}