|
1 | 1 | tosca_definitions_version: cloudify_dsl_1_3 |
2 | 2 |
|
3 | 3 | description: > |
4 | | - Create an AWS VPC based on the Scenario 2 design. |
| 4 | + Create an Example Openstack Network. |
5 | 5 |
|
6 | 6 | imports: |
7 | 7 | - http://www.getcloudify.org/spec/cloudify/4.2/types.yaml |
8 | | - - http://www.getcloudify.org/spec/awssdk-plugin/1.2.0.1/plugin.yaml |
| 8 | + - http://www.getcloudify.org/spec/openstack-plugin/2.5.2/plugin.yaml |
9 | 9 |
|
10 | 10 | inputs: |
11 | 11 |
|
12 | | - aws_access_key_id: |
13 | | - description: YOUR AWS ACCESS KEY ID |
14 | | - default: { get_secret: aws_access_key_id } |
| 12 | + username: |
| 13 | + description: OS_USERNAME as specified in Openstack RC file. |
| 14 | + default: { get_secret: keystone_username } |
15 | 15 |
|
16 | | - aws_secret_access_key: |
17 | | - description: YOUR AWS SECRET ACCESS KEY |
18 | | - default: { get_secret: aws_secret_access_key } |
| 16 | + password: |
| 17 | + description: Openstack user password. |
| 18 | + default: { get_secret: keystone_password } |
19 | 19 |
|
20 | | - ec2_region_name: |
21 | | - default: { get_secret: ec2_region_name } |
| 20 | + tenant_name: |
| 21 | + description: OS_TENANT_NAME as specified in Openstack RC file. |
| 22 | + default: { get_secret: keystone_tenant_name } |
22 | 23 |
|
23 | | - ec2_region_endpoint: |
24 | | - default: { get_secret: ec2_region_endpoint } |
| 24 | + auth_url: |
| 25 | + description: OS_AUTH_URL as specified in Openstack RC file. |
| 26 | + default: { get_secret: keystone_url } |
25 | 27 |
|
26 | | - availability_zone: |
27 | | - default: { get_secret: availability_zone } |
| 28 | + region: |
| 29 | + description: OS_REGION_NAME as specified in Openstack RC file. |
| 30 | + default: { get_secret: keystone_region } |
28 | 31 |
|
29 | | - vpc_cidr: |
30 | | - default: 10.10.0.0/16 |
| 32 | + external_network_name: |
| 33 | + description: Openstack tenant external network name. |
| 34 | + |
| 35 | + nameservers: |
| 36 | + default: [8.8.4.4, 8.8.8.8] |
31 | 37 |
|
32 | 38 | public_subnet_cidr: |
33 | | - default: 10.10.0.0/24 |
| 39 | + default: 192.168.120.0/24 |
| 40 | + |
| 41 | + public_subnet_allocation_pools: |
| 42 | + default: |
| 43 | + - start: 192.168.120.2 |
| 44 | + end: 192.168.120.254 |
34 | 45 |
|
35 | 46 | private_subnet_cidr: |
36 | | - default: 10.10.1.0/24 |
| 47 | + default: 192.168.121.0/24 |
| 48 | + |
| 49 | + private_subnet_allocation_pools: |
| 50 | + default: |
| 51 | + - start: 192.168.121.2 |
| 52 | + end: 192.168.121.254 |
37 | 53 |
|
38 | 54 | dsl_definitions: |
39 | 55 |
|
40 | | - aws_config: &client_config |
41 | | - aws_access_key_id: { get_input: aws_access_key_id } |
42 | | - aws_secret_access_key: { get_input: aws_secret_access_key } |
43 | | - region_name: { get_input: ec2_region_name } |
| 56 | + client_config: &client_config |
| 57 | + username: { get_input: username } |
| 58 | + password: { get_input: password } |
| 59 | + tenant_name: { get_input: tenant_name } |
| 60 | + auth_url: { get_input: auth_url } |
| 61 | + region: { get_input: region } |
44 | 62 |
|
45 | 63 | node_templates: |
46 | 64 |
|
47 | | - vpc: |
48 | | - type: cloudify.nodes.aws.ec2.Vpc |
| 65 | + external_network: |
| 66 | + type: cloudify.openstack.nodes.Network |
49 | 67 | properties: |
50 | | - resource_config: |
51 | | - kwargs: |
52 | | - CidrBlock: { get_input: vpc_cidr } |
53 | | - client_config: *client_config |
| 68 | + openstack_config: *client_config |
| 69 | + use_external_resource: true |
| 70 | + resource_id: { get_input: external_network_name } |
54 | 71 |
|
55 | | - internet_gateway: |
56 | | - type: cloudify.nodes.aws.ec2.InternetGateway |
| 72 | + public_network: |
| 73 | + type: cloudify.openstack.nodes.Network |
57 | 74 | properties: |
58 | | - client_config: *client_config |
59 | | - relationships: |
60 | | - - type: cloudify.relationships.connected_to |
61 | | - target: vpc |
62 | | - |
63 | | - public_subnet: |
64 | | - type: cloudify.nodes.aws.ec2.Subnet |
65 | | - properties: |
66 | | - resource_config: |
67 | | - kwargs: |
68 | | - CidrBlock: { get_input: public_subnet_cidr } |
69 | | - AvailabilityZone: { get_input: availability_zone } |
70 | | - client_config: *client_config |
71 | | - relationships: |
72 | | - - type: cloudify.relationships.depends_on |
73 | | - target: vpc |
74 | | - - type: cloudify.relationships.depends_on |
75 | | - target: internet_gateway |
| 75 | + openstack_config: *client_config |
76 | 76 |
|
77 | | - private_subnet: |
78 | | - type: cloudify.nodes.aws.ec2.Subnet |
| 77 | + private_network: |
| 78 | + type: cloudify.openstack.nodes.Network |
79 | 79 | properties: |
80 | | - resource_config: |
81 | | - kwargs: |
82 | | - CidrBlock: { get_input: private_subnet_cidr } |
83 | | - AvailabilityZone: { get_input: availability_zone } |
84 | | - client_config: *client_config |
85 | | - relationships: |
86 | | - - type: cloudify.relationships.depends_on |
87 | | - target: vpc |
88 | | - - type: cloudify.relationships.depends_on |
89 | | - target: internet_gateway |
| 80 | + openstack_config: *client_config |
90 | 81 |
|
91 | | - public_subnet_routetable: |
92 | | - type: cloudify.nodes.aws.ec2.RouteTable |
| 82 | + public_network_router: |
| 83 | + type: cloudify.openstack.nodes.Router |
93 | 84 | properties: |
94 | | - client_config: *client_config |
| 85 | + openstack_config: *client_config |
95 | 86 | relationships: |
96 | | - - type: cloudify.relationships.contained_in |
97 | | - target: vpc |
98 | 87 | - type: cloudify.relationships.connected_to |
99 | | - target: public_subnet |
| 88 | + target: external_network |
100 | 89 |
|
101 | | - private_subnet_routetable: |
102 | | - type: cloudify.nodes.aws.ec2.RouteTable |
| 90 | + public_subnet: |
| 91 | + type: cloudify.openstack.nodes.Subnet |
103 | 92 | properties: |
104 | | - client_config: *client_config |
| 93 | + openstack_config: *client_config |
| 94 | + subnet: |
| 95 | + ip_version: 4 |
| 96 | + cidr: { get_input: public_subnet_cidr } |
| 97 | + dns_nameservers: { get_input: nameservers } |
| 98 | + allocation_pools: { get_input: public_subnet_allocation_pools } |
105 | 99 | relationships: |
106 | 100 | - type: cloudify.relationships.contained_in |
107 | | - target: vpc |
108 | | - - type: cloudify.relationships.connected_to |
109 | | - target: private_subnet |
| 101 | + target: public_network |
| 102 | + - type: cloudify.openstack.subnet_connected_to_router |
| 103 | + target: public_network_router |
110 | 104 |
|
111 | | - route_public_subnet_internet_gateway: |
112 | | - type: cloudify.nodes.aws.ec2.Route |
| 105 | + private_subnet: |
| 106 | + type: cloudify.openstack.nodes.Subnet |
113 | 107 | properties: |
114 | | - resource_config: |
115 | | - kwargs: |
116 | | - DestinationCidrBlock: '0.0.0.0/0' |
117 | | - client_config: *client_config |
| 108 | + openstack_config: *client_config |
| 109 | + subnet: |
| 110 | + ip_version: 4 |
| 111 | + cidr: { get_input: private_subnet_cidr } |
| 112 | + dns_nameservers: { get_input: nameservers } |
| 113 | + allocation_pools: { get_input: private_subnet_allocation_pools } |
118 | 114 | relationships: |
119 | 115 | - type: cloudify.relationships.contained_in |
120 | | - target: public_subnet_routetable |
121 | | - - type: cloudify.relationships.connected_to |
122 | | - target: internet_gateway |
123 | | - interfaces: |
124 | | - cloudify.interfaces.lifecycle: |
125 | | - stop: {} |
| 116 | + target: private_network |
| 117 | + - type: cloudify.openstack.subnet_connected_to_router |
| 118 | + target: public_network_router |
126 | 119 |
|
127 | 120 | outputs: |
128 | 121 |
|
129 | | - vpc_id: |
130 | | - value: { get_attribute: [ vpc, aws_resource_id ] } |
| 122 | + external_network: |
| 123 | + value: { get_attribute: [ external_network, external_id ] } |
131 | 124 |
|
132 | | - public_subnet_id: |
133 | | - value: { get_attribute: [ public_subnet, aws_resource_id ] } |
| 125 | + public_network_router: |
| 126 | + value: { get_attribute: [ public_network_router, external_id ] } |
134 | 127 |
|
135 | | - private_subnet_id: |
136 | | - value: { get_attribute: [ private_subnet, aws_resource_id ] } |
| 128 | + public_network: |
| 129 | + value: { get_attribute: [ public_network, external_id ] } |
137 | 130 |
|
138 | | - ec2_region_name: |
139 | | - value: { get_input: ec2_region_name } |
| 131 | + private_network: |
| 132 | + value: { get_attribute: [ private_network, external_id ] } |
140 | 133 |
|
141 | | - ec2_region_endpoint: |
142 | | - value: { get_input: ec2_region_endpoint } |
| 134 | + public_subnet: |
| 135 | + value: { get_attribute: [ public_subnet, external_id ] } |
143 | 136 |
|
144 | | - availability_zone: |
145 | | - value: { get_input: availability_zone } |
| 137 | + private_subnet: |
| 138 | + value: { get_attribute: [ private_subnet, external_id ] } |
0 commit comments