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