|
| 1 | +heat_template_version: '2014-10-16' |
| 2 | + |
| 3 | +parameters: |
| 4 | + keypair: |
| 5 | + type: string |
| 6 | + constraints: |
| 7 | + - custom_constraint: nova.keypair |
| 8 | + goc_portal_ip: |
| 9 | + type: string |
| 10 | + default: '10.113.2.121' |
| 11 | + goc_portal_tenant_id: |
| 12 | + type: number |
| 13 | + default: 2 |
| 14 | + goc_portal_tenant_admin_api_token: |
| 15 | + type: string |
| 16 | + default: 'fcae06c93fddb7a33d33428130ce1aac04cf1d32' |
| 17 | + goc_portal_tenant_name: |
| 18 | + type: string |
| 19 | + default: 'robert201630' |
| 20 | + goc_portal_tenant_admin_username: |
| 21 | + type: string |
| 22 | + |
| 23 | + goc_portal_tenant_admin_openstack_user_id: |
| 24 | + type: string |
| 25 | + default: '87f0ddd4874740ff9a513620171110fd' |
| 26 | + openstack_auth_url: |
| 27 | + type: string |
| 28 | + default: 'http://10.113.1.2:5000/v2.0' |
| 29 | + sportal_admin_account: |
| 30 | + type: string |
| 31 | + default: 'admin' |
| 32 | + sportal_admin_group_name: |
| 33 | + type: string |
| 34 | + default: 'gemini' |
| 35 | + sportal_admin_password: |
| 36 | + type: string |
| 37 | + default: 'password' |
| 38 | + sportal_admin_email: |
| 39 | + type: string |
| 40 | + default: 'admin@gemini' |
| 41 | + |
| 42 | +resources: |
| 43 | + service_portal_instance: |
| 44 | + type: OS::Nova::Server |
| 45 | + properties: |
| 46 | + flavor: '2cores4GBmemory40GBdisk' |
| 47 | + networks: |
| 48 | + - network: 'default_network' |
| 49 | + image: 'ServicePortal' |
| 50 | + key_name: {get_param: keypair} |
| 51 | + security_groups: [{ get_resource: service_portal_sg }] |
| 52 | + availability_zone: 'nova' |
| 53 | + user_data_format: RAW |
| 54 | + user_data: |
| 55 | + str_replace: |
| 56 | + template: | |
| 57 | + #!/bin/bash |
| 58 | + sed -i '/portal_ip/ c\portal_ip = "$GOC_PORTAL_IP"' /usr/share/sportal/sportal/configs.py |
| 59 | + sed -i '/tenant_id/ c\tenant_id = "$GOC_PORTAL_TENANT_ID"' /usr/share/sportal/sportal/configs.py |
| 60 | + sed -i '/tenant_admin_token/ c\tenant_admin_token = "$GOC_PORTAL_TENANT_ADMIN_API_TOKEN"' /usr/share/sportal/sportal/configs.py |
| 61 | + sed -i '/tenant_name/ c\tenant_name = "$GOC_PORTAL_TENANT_NAME"' /usr/share/sportal/sportal/configs.py |
| 62 | + sed -i '/tenant_admin_username/ c\tenant_admin_username = "$GOC_PORTAL_TENANT_ADMIN_USERNAME"' /usr/share/sportal/sportal/configs.py |
| 63 | + sed -i '/tenant_admin_openstack_user_id/ c\tenant_admin_openstack_user_id = "$GOC_PORTAL_TENANT_ADMIN_OPENSTACK_USER_ID"' /usr/share/sportal/sportal/configs.py |
| 64 | + sed -i '/openstack_auth_url/ c\openstack_auth_url = "$OPENSTACK_AUTH_URL"' /usr/share/sportal/sportal/configs.py |
| 65 | + sed -i '/ADMIN_ACCOUNT/ c\ADMIN_ACCOUNT = "$SPORTAL_ADMIN_ACCOUNT"' /usr/share/sportal/sportal/settings.py |
| 66 | + sed -i '/ADMIN_GROUP_NAME/ c\ADMIN_GROUP_NAME = "$SPORTAL_ADMIN_GROUP_NAME"' /usr/share/sportal/sportal/settings.py |
| 67 | + sed -i '/\<ADMIN_PASSWORD\>/ c\ADMIN_PASSWORD = "$SPORTAL_ADMIN_PASSWORD"' /usr/share/sportal/sportal/settings.py |
| 68 | + sed -i '/ADMIN_EMAIL/ c\ADMIN_EMAIL = "$SPORTAL_ADMIN_EMAIL"' /usr/share/sportal/sportal/settings.py |
| 69 | + sed -i '/\<ADMIN_USER_NAME\>/ c\ADMIN_USER_NAME = "$SPORTAL_ADMIN_ACCOUNT@$SPORTAL_ADMIN_GROUP_NAME"' /usr/share/sportal/sportal/settings.py |
| 70 | + cd /usr/share/sportal |
| 71 | + python init.py |
| 72 | + params: |
| 73 | + $GOC_PORTAL_IP: { get_param: goc_portal_ip } |
| 74 | + $GOC_PORTAL_TENANT_ID: { get_param: goc_portal_tenant_id } |
| 75 | + $GOC_PORTAL_TENANT_ADMIN_API_TOKEN: { get_param: goc_portal_tenant_admin_api_token } |
| 76 | + $GOC_PORTAL_TENANT_NAME: { get_param: goc_portal_tenant_name } |
| 77 | + $GOC_PORTAL_TENANT_ADMIN_USERNAME: { get_param: goc_portal_tenant_admin_username } |
| 78 | + $GOC_PORTAL_TENANT_ADMIN_OPENSTACK_USER_ID: { get_param: goc_portal_tenant_admin_openstack_user_id } |
| 79 | + $OPENSTACK_AUTH_URL: { get_param: openstack_auth_url } |
| 80 | + $SPORTAL_ADMIN_ACCOUNT: { get_param: sportal_admin_account } |
| 81 | + $SPORTAL_ADMIN_GROUP_NAME: { get_param: sportal_admin_group_name } |
| 82 | + $SPORTAL_ADMIN_PASSWORD: { get_param: sportal_admin_password } |
| 83 | + $SPORTAL_ADMIN_EMAIL: { get_param: sportal_admin_email } |
| 84 | + service_portal_ip_association: |
| 85 | + type: OS::Nova::FloatingIPAssociation |
| 86 | + properties: |
| 87 | + floating_ip: {get_resource: service_portal_floating_ip} |
| 88 | + server_id: {get_resource: service_portal_instance} |
| 89 | + service_portal_floating_ip: |
| 90 | + type: OS::Nova::FloatingIP |
| 91 | + properties: |
| 92 | + pool: 'net04_ext' |
| 93 | + service_portal_sg: |
| 94 | + type: OS::Neutron::SecurityGroup |
| 95 | + properties: |
| 96 | + description: firewall rules for Service Portal. 4505/4506 for salt. |
| 97 | + name: |
| 98 | + str_replace: |
| 99 | + template: $stack_name_service_portal_sg |
| 100 | + params: |
| 101 | + $stack_name: {get_param: "OS::stack_name"} |
| 102 | + rules: [ |
| 103 | + {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22}, |
| 104 | + {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 80, port_range_max: 80}, |
| 105 | + {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 443, port_range_max: 443}, |
| 106 | + {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 4505, port_range_max: 4506}, |
| 107 | + {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 8000, port_range_max: 8000}, |
| 108 | + {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}] |
| 109 | + |
| 110 | +outputs: |
| 111 | + Service_Portal_url: |
| 112 | + description: Service Portal url |
| 113 | + value: |
| 114 | + str_replace: |
| 115 | + template: http://service_portal/ |
| 116 | + params: |
| 117 | + service_portal: {get_attr: [service_portal_floating_ip, ip]} |
| 118 | + service_portal_group_info: |
| 119 | + description: Group Info |
| 120 | + value: {get_attr: [service_portal_instance, show]} |
0 commit comments