Merge "Use -net=host for docker-puppet.py config gen"
[apex-tripleo-heat-templates.git] / deployed-server / deployed-server.yaml
1 heat_template_version: ocata
2 parameters:
3   image:
4     type: string
5     default: unused
6   flavor:
7     type: string
8     default: unused
9   key_name:
10     type: string
11     default: unused
12   security_groups:
13     type: json
14     default: []
15   # Require this so we can validate the parent passes the
16   # correct value
17   user_data_format:
18     type: string
19   user_data:
20     type: string
21     default: ''
22   name:
23     type: string
24     default: 'deployed-server'
25   image_update_policy:
26     type: string
27     default: ''
28   networks:
29     type: comma_delimited_list
30     default: ''
31   metadata:
32     type: json
33     default: {}
34   software_config_transport:
35     default: POLL_SERVER_CFN
36     type: string
37   scheduler_hints:
38     type: json
39     description: Optional scheduler hints to pass to nova
40     default: {}
41   UpgradeInitCommand:
42     type: string
43     description: |
44       Command or script snippet to run on all overcloud nodes to
45       initialize the upgrade process. E.g. a repository switch.
46     default: ''
47
48 resources:
49   deployed-server:
50     type: OS::Heat::DeployedServer
51     properties:
52       name: {get_param: name}
53       software_config_transport: {get_param: software_config_transport}
54
55   UpgradeInitConfig:
56     type: OS::Heat::SoftwareConfig
57     properties:
58       group: script
59       config:
60         list_join:
61         - ''
62         - - "#!/bin/bash\n\n"
63           - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
64           - get_param: UpgradeInitCommand
65
66   UpgradeInitDeployment:
67     type: OS::Heat::SoftwareDeployment
68     properties:
69       name: UpgradeInitDeployment
70       server: {get_resource: deployed-server}
71       config: {get_resource: UpgradeInitConfig}
72
73
74   InstanceIdConfig:
75     type: OS::Heat::StructuredConfig
76     properties:
77       group: apply-config
78       config:
79         instance-id: {get_resource: deployed-server}
80
81   InstanceIdDeployment:
82     type: OS::Heat::StructuredDeployment
83     properties:
84       name: InstanceIdDeployment
85       config: {get_resource: InstanceIdConfig}
86       server: {get_resource: deployed-server}
87     depends_on: UpgradeInitDeployment
88
89   HostsEntryConfig:
90     type: OS::Heat::SoftwareConfig
91     properties:
92       group: script
93       config: |
94           #!/bin/bash
95           set -eux
96           mkdir -p $heat_outputs_path
97           host=$(hostname -s)
98           echo -n $host > $heat_outputs_path.hostname
99           cat $heat_outputs_path.hostname
100       outputs:
101         - name: hostname
102           description: hostname
103
104   HostsEntryDeployment:
105     type: OS::Heat::SoftwareDeployment
106     properties:
107       name: HostsEntryDeployment
108       config: {get_resource: HostsEntryConfig}
109       server: {get_resource: deployed-server}
110
111   DeployedServerBootstrapConfig:
112     type: OS::TripleO::DeployedServer::Bootstrap
113     properties:
114       server: {get_resource: deployed-server}
115
116   ControlPlanePort:
117     type: OS::TripleO::DeployedServer::ControlPlanePort
118     properties:
119       network: ctlplane
120       name:
121         list_join:
122           - '-'
123           - - {get_attr: [HostsEntryDeployment, hostname]}
124             - ctlplane
125       replacement_policy: AUTO
126
127 outputs:
128   OS::stack_id:
129     value: {get_resource: deployed-server}
130   networks:
131     value:
132       ctlplane:
133         - {get_attr: [ControlPlanePort, fixed_ips, 0, ip_address]}
134   name:
135     value: {get_attr: [HostsEntryDeployment, hostname]}