Add role specific information to the service template
[apex-tripleo-heat-templates.git] / puppet / services / ceph-mon.yaml
1 heat_template_version: ocata
2
3 description: >
4   Ceph Monitor service.
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   CephIPv6:
30     default: False
31     type: boolean
32   CephMonKey:
33     description: The Ceph monitors key. Can be created with ceph-authtool --gen-print-key.
34     type: string
35     hidden: true
36   CinderRbdPoolName:
37     default: volumes
38     type: string
39   ManilaCephFSDataPoolName:
40     default: manila_data
41     type: string
42   ManilaCephFSMetadataPoolName:
43     default: manila_metadata
44     type: string
45   CinderBackupRbdPoolName:
46     default: backups
47     type: string
48   GlanceRbdPoolName:
49     default: images
50     type: string
51   GnocchiRbdPoolName:
52     default: metrics
53     type: string
54   NovaRbdPoolName:
55     default: vms
56     type: string
57   CephPools:
58     description: >
59       It can be used to override settings for one of the predefined pools, or to create
60       additional ones. Example:
61       {
62         "volumes": {
63           "size": 5,
64           "pg_num": 128,
65           "pgp_num": 128
66          }
67       }
68     default: {}
69     type: json
70   CephValidationRetries:
71     type: number
72     default: 5
73     description: Number of retry attempts for Ceph validation
74   CephValidationDelay:
75     type: number
76     default: 10
77     description: Interval (in seconds) in between validation checks
78   MonitoringSubscriptionCephMon:
79     default: 'overcloud-ceph-mon'
80     type: string
81
82 resources:
83   CephBase:
84     type: ./ceph-base.yaml
85     properties:
86       ServiceNetMap: {get_param: ServiceNetMap}
87       DefaultPasswords: {get_param: DefaultPasswords}
88       EndpointMap: {get_param: EndpointMap}
89       RoleName: {get_param: RoleName}
90       RoleParameters: {get_param: RoleParameters}
91
92 outputs:
93   role_data:
94     description: Role data for the Ceph Monitor service.
95     value:
96       service_name: ceph_mon
97       monitoring_subscription: {get_param: MonitoringSubscriptionCephMon}
98       config_settings:
99         map_merge:
100           - get_attr: [CephBase, role_data, config_settings]
101           - ceph::profile::params::ms_bind_ipv6: {get_param: CephIPv6}
102             ceph::profile::params::mon_key: {get_param: CephMonKey}
103             ceph::profile::params::osd_pool_default_pg_num: 32
104             ceph::profile::params::osd_pool_default_pgp_num: 32
105             ceph::profile::params::osd_pool_default_size: 3
106             # repeat returns items in a list, so we need to map_merge twice
107             tripleo::profile::base::ceph::mon::ceph_pools:
108               map_merge:
109                 - map_merge:
110                     repeat:
111                       for_each:
112                         <%pool%>:
113                           - {get_param: CinderRbdPoolName}
114                           - {get_param: ManilaCephFSDataPoolName}
115                           - {get_param: ManilaCephFSMetadataPoolName}
116                           - {get_param: CinderBackupRbdPoolName}
117                           - {get_param: NovaRbdPoolName}
118                           - {get_param: GlanceRbdPoolName}
119                           - {get_param: GnocchiRbdPoolName}
120                       template:
121                         <%pool%>:
122                           pg_num: "%{hiera('ceph::profile::params::osd_pool_default_pg_num')}"
123                           pgp_num: "%{hiera('ceph::profile::params::osd_pool_default_pgp_num')}"
124                           size: "%{hiera('ceph::profile::params::osd_pool_default_size')}"
125                 - {get_param: CephPools}
126             tripleo.ceph_mon.firewall_rules:
127               '110 ceph_mon':
128                 dport:
129                   - 6789
130       service_config_settings:
131         get_attr: [CephBase, role_data, service_config_settings]
132       step_config: |
133         include ::tripleo::profile::base::ceph::mon
134       upgrade_batch_tasks:
135         # Note we perform these tasks in list order, but they are all step0 so
136         # we can perform a rolling upgrade of all mon nodes in step0, then a
137         # rolling upgrade of all osd nodes in step1
138         - name: Check status
139           tags: step0,validation
140           shell: ceph health | egrep -sq "HEALTH_OK|HEALTH_WARN"
141         - name: Stop CephMon
142           tags: step0
143           service:
144             name: ceph-mon@{{ ansible_hostname }}
145             state: stopped
146         - name: Update Ceph packages
147           tags: step0
148           yum:
149             name: ceph-mon
150             state: latest
151         - name: Start CephMon
152           tags: step0
153           service:
154             name: ceph-mon@{{ ansible_hostname }}
155             state: started
156         # ceph-ansible
157         # https://github.com/ceph/ceph-ansible/blob/master/infrastructure-playbooks/rolling_update.yml#L149-L157
158         - name: Wait for the monitor to join the quorum...
159           tags: step0,ceph_quorum_validation
160           shell: |
161             ceph -s | grep monmap | sed 's/.*quorum//' | egrep -sq {{ ansible_hostname }}
162           register: ceph_quorum_nodecheck
163           until: ceph_quorum_nodecheck.rc == 0
164           retries: {get_param: CephValidationRetries}
165           delay: {get_param: CephValidationDelay}
166         - name: ceph osd crush tunables default
167           tags: step0
168           shell: ceph osd crush tunables default