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