Merge "Update the template_version alias for all the templates to pike."
[apex-tripleo-heat-templates.git] / puppet / services / etcd.yaml
1 heat_template_version: pike
2
3 description: >
4   Etcd service configured with Puppet
5
6 parameters:
7   ServiceNetMap:
8     default: {}
9     description: Mapping of service_name -> network name. Typically set
10                  via parameter_defaults in the resource registry.  This
11                  mapping overrides those in ServiceNetMapDefaults.
12     type: json
13   DefaultPasswords:
14     default: {}
15     type: json
16   RoleName:
17     default: ''
18     description: Role name on which the service is applied
19     type: string
20   RoleParameters:
21     default: {}
22     description: Parameters specific to the role
23     type: json
24   EndpointMap:
25     default: {}
26     description: Mapping of service endpoint -> protocol. Typically set
27                  via parameter_defaults in the resource registry.
28     type: json
29   EtcdInitialClusterToken:
30     description: Initial cluster token for the etcd cluster during bootstrap.
31     type: string
32     hidden: true
33   MonitoringSubscriptionEtcd:
34     default: 'overcloud-etcd'
35     type: string
36   EnableInternalTLS:
37     type: boolean
38     default: false
39
40 conditions:
41
42   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
43
44 outputs:
45   role_data:
46     description: Role data for the Etcd role.
47     value:
48       service_name: etcd
49       monitoring_subscription: {get_param: MonitoringSubscriptionEtcd}
50       config_settings:
51         map_merge:
52         -
53           etcd::etcd_name:
54             str_replace:
55               template:
56                 "%{hiera('fqdn_$NETWORK')}"
57               params:
58                 $NETWORK: {get_param: [ServiceNetMap, EtcdNetwork]}
59           # NOTE: bind IP is found in Heat replacing the network name with the local node IP
60           # for the given network; replacement examples (eg. for internal_api):
61           # internal_api -> IP
62           # internal_api_uri -> [IP]
63           # internal_api_subnet - > IP/CIDR
64           tripleo::profile::base::etcd::bind_ip: {get_param: [ServiceNetMap, EtcdNetwork]}
65           tripleo::profile::base::etcd::client_port: '2379'
66           tripleo::profile::base::etcd::peer_port: '2380'
67           etcd::initial_cluster_token: {get_param: EtcdInitialClusterToken}
68           etcd::manage_package: false
69           tripleo.etcd.firewall_rules:
70             '141 etcd':
71               dport:
72                 - 2379
73                 - 2380
74         -
75           if:
76           - internal_tls_enabled
77           - generate_service_certificates: true
78             tripleo::profile::base::etcd::certificate_specs:
79               service_certificate: '/etc/pki/tls/certs/etcd.crt'
80               service_key: '/etc/pki/tls/private/etcd.key'
81               hostname:
82                 str_replace:
83                   template: "%{hiera('fqdn_NETWORK')}"
84                   params:
85                     NETWORK: {get_param: [ServiceNetMap, EtcdNetwork]}
86               principal:
87                 str_replace:
88                   template: "etcd/%{hiera('fqdn_NETWORK')}"
89                   params:
90                     NETWORK: {get_param: [ServiceNetMap, EtcdNetwork]}
91           - {}
92       step_config: |
93         include ::tripleo::profile::base::etcd
94       upgrade_tasks:
95         - name: Check if etcd is deployed
96           command: systemctl is-enabled etcd
97           tags: step0,validation
98           ignore_errors: True
99           register: etcd_enabled
100         - name: "PreUpgrade step0,validation: Check if etcd is running"
101           shell: >
102             /usr/bin/systemctl show 'etcd' --property ActiveState |
103             grep '\bactive\b'
104           when: etcd_enabled.rc == 0
105           tags: step0,validation
106         - name: Stop etcd service
107           tags: step2
108           service: name=etcd state=stopped
109       metadata_settings:
110         if:
111           - internal_tls_enabled
112           -
113             - service: etcd
114               network: {get_param: [ServiceNetMap, EtcdNetwork]}
115               type: node
116           - null