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