Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

i am trying to associate floating ip to 2 server in my stack below is what i have tried

heat_template_version: 2014-10-16

description: >
  Stack to prepare network and instances for deploying the nodes for Elasticsearch.

    parameters:
      # Stack Parameters
      stack_prefix:
        type: string
        label: prefix for resource names
        description: prefix for resource names
      stack_image:
        type: string
        label: Image
        description: Name of Image to use for the nodes.
      stack_key_name:
        type: string
        label: stack Key
        description: Name of key pair to use for the nodes in the stack.
      availability_zone_list:
        type: comma_delimited_list
        label: Availability zone list
        description: Availability zone list

  # Node Parameters
  node_flavor:
    type: string
    label: Node Flavor
    description: Name of flavor to use for the origin nodes.
  node_count:
    type: number
    label: Node count
    description: Number of origin nodes to deploy.


  # Networking Parameters
  router_id:
    type: string
    label: Router ID
    description: ID of the router to uplink everything to
  external_network_id:
    type: string
    label: External Network ID
  dns_nameservers:
    type: comma_delimited_list
    label: DNS Nameservers
  default_security_group_id:
    type: string
    label: ID for Default Security Group
  subnet_prefix:
    type: string
    label: prefix for subnet ip
    description: prefix for subnet ip
  subnet_pool_start:
    type: string
    label: subnet pool start
  subnet_pool_end:
    type: string
    label: subnet pool end
  port:
    type: string
    label: Server port
    description: The server port that receives the floating IP address.
  public_network:
    type: string
    label: Public network name or ID
    description: Public network with floating IP addresses.
    default: public
  private_network:
    type: string
    label: Public network name or ID
    description: Public network with floating IP addresses.
    default: private
resources:
  # Security Groups
  elk_security_group:
    type: OS::Neutron::SecurityGroup
    properties:
       description: 'Security group for ICMP, HTTP and SSH'
       name: elk_sec_group
       rules:
        - direction: ingress
          ethertype: IPv4
          protocol: tcp
          port_range_min: 80
          port_range_max: 80
        - protocol: tcp
          port_range_min: 443
          port_range_max: 443
        - protocol: icmp
        - direction: ingress
          ethertype: IPv4
          protocol: tcp
          port_range_min: 22
          port_range_max: 22
        - direction: egress
          ethertype: IPv4
          remote_ip_prefix: 0.0.0.0/0

  origin_network:
    type: OS::Neutron::Net
    properties:
      name:
        list_join: ['-', [ {get_param: stack_prefix}, 'net']]
  origin_subnet:
    type: OS::Neutron::Subnet
    properties:
      cidr:
        list_join: ['.', [ {get_param: subnet_prefix}, '0/24']]
      gateway_ip:
        list_join: ['.', [ {get_param: subnet_prefix}, '1']]
      name:
        list_join: ['-', [ {get_param: stack_prefix}, 'subnet']]
      network_id: { get_resource: origin_network }
      dns_nameservers: { get_param: dns_nameservers }
      allocation_pools:
        - start:
            list_join: ['.', [ {get_param: subnet_prefix}, {get_param: subnet_pool_start}]]
          end:
            list_join: ['.', [ {get_param: subnet_prefix}, {get_param: subnet_pool_end}]]

  origin_network_uplink:
    type: OS::Neutron::RouterInterface
    properties:
      router_id: { get_param: router_id }
      subnet_id: { get_resource: origin_subnet }


  web_nodes:
    type: OS::Heat::ResourceGroup
    depends_on:
      - origin_network_uplink
    properties:
      count: { get_param: node_count }
      resource_def:
        type: Paas::builds::Node
        properties:
          name:
            list_join: ['-', [ {get_param: stack_prefix}, 'web-node' ,'%index%']]
          availability_zones: { get_param: availability_zone_list }
          az_index: '%index%'
          ip_address:
            list_join: ['', [ {get_param: subnet_prefix},'.2', '%index%']]
          image: { get_param: stack_image }
          flavor: { get_param: node_flavor }
          key_name: { get_param: stack_key_name }
          private_network_id: { get_resource: origin_network }
          port: { get_param: port}
          public_network: { get_param: public_network}
          security_groups:
            - { get_param: default_security_group_id}
            - { get_resource: elk_security_group }

  #floating_port:
    #type: OS::Neutron::Port
    #properties:
      #network: { get_resource: origin_network }
      #security_groups: { get_resource: elk_security_group }
      #fixed_ips: list_join: {get_param: subnet_prefix}

  floating_ip:
    type: OS::Neutron::FloatingIP
    properties:
      #fixed_ip_address: { get_param: subnet_prefix}
      floating_network: { get_param: public_network }

  floating_ip_assoc:
    type: OS::Neutron::FloatingIPAssociation
    properties:
      floatingip_id: { get_resource: floating_ip }
      port_id: { get_param: port }

and below is the env.yaml

resource_registry:
  "Paas::builds::Node": builds/node.yaml
  #"Paas::builds::Lb": builds/lb.yaml

parameters:
  ##Tenent Details##
  stack_prefix: ELK-CHD
  stack_key_name: ELK
  stack_image: RHEL-
  # server_image: RHEL_Atomic_7.2

  default_security_group_id: cd4f63d5-1fe7-4a06-bc45-cfd3df1da357

  ##Network Details##
  #Subnet settings
  subnet_prefix: '192.168.3'
  subnet_pool_start: '70'
  subnet_pool_end: '99'

  # The router ID, obtained by running 'neutron router-list'
  router_id: 6fe68c74-0d86-4e63-bba1-36b18022c187

  # External Network to assign Floating IPs from. Obtained by running
  #   # 'neutron net-external-list'
  external_network_id: 001380f4-90a5-42f8-b055-4118ed26ccd5

  # List of Name servers to be added to the subnet & hosts by default
  # 

  dns_nameservers:
    - 10.160.12.70

  #private_network: 001380f4-90a5-42f8-b055-4118ed26ccd5
  public_network: 001380f4-90a5-42f8-b055-4118ed26ccd5

  port: a1c4334e-2ec6-4791-ac7d-c8d4a9288cfa

  # List of availability zones.  Repeat as needed to account for all instance indexes.

  availability_zone_list: ["AZ1","AZ2","AZ3","AZ1","AZ2","AZ3","AZ1","AZ2","AZ3","AZ1","AZ2","AZ3"]

  ##Server Details##
  # origin node configuration

  node_count: 2
  node_flavor: r3.large