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