Merge "Add checks in ansible upgrade tasks for CephMon and CephOSD"
[apex-tripleo-heat-templates.git] / puppet / services / ceph-osd.yaml
1 heat_template_version: ocata
2
3 description: >
4   Ceph OSD 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   MonitoringSubscriptionCephOsd:
22     default: 'overcloud-ceph-osd'
23     type: string
24   CephValidationRetries:
25     type: number
26     default: 40
27     description: Number of retry attempts for Ceph validation
28   CephValidationDelay:
29     type: number
30     default: 30
31     description: Interval (in seconds) in between validation checks
32   IgnoreCephUpgradeWarnings:
33     type: boolean
34     default: false
35     description: If enabled, Ceph upgrade will be forced even though cluster or PGs status is not clean
36
37 parameter_groups:
38 - label: deprecated
39   description: Do not use deprecated params, they will be removed.
40   parameters:
41   - IgnoreCephUpgradeWarnings
42
43 resources:
44   CephBase:
45     type: ./ceph-base.yaml
46     properties:
47       ServiceNetMap: {get_param: ServiceNetMap}
48       DefaultPasswords: {get_param: DefaultPasswords}
49       EndpointMap: {get_param: EndpointMap}
50
51 outputs:
52   role_data:
53     description: Role data for the Cinder OSD service.
54     value:
55       service_name: ceph_osd
56       monitoring_subscription: {get_param: MonitoringSubscriptionCephOsd}
57       config_settings:
58         map_merge:
59           - get_attr: [CephBase, role_data, config_settings]
60           - tripleo.ceph_osd.firewall_rules:
61               '111 ceph_osd':
62                 dport:
63                   - '6800-7300'
64       step_config: |
65         include ::tripleo::profile::base::ceph::osd
66       upgrade_batch_tasks:
67         - name: Check status
68           tags: step1,validation
69           shell: ceph health | grep -qv HEALTH_ERR
70         - name: Get OSD IDs
71           tags: step1
72           shell: ls /var/lib/ceph/osd | awk 'BEGIN { FS = "-" } ; { print $2 }'
73           register: osd_ids
74           # "so that mirrors aren't rebalanced as if the OSD died" - gfidente / leseb
75         - name: ceph osd set noout
76           tags: step1
77           command: ceph osd set noout
78         - name: ceph osd set norebalance
79           tags: step1
80           command: ceph osd set norebalance
81         - name: ceph osd set nodeep-scrub
82           tags: step1
83           command: ceph osd set nodeep-scrub
84         - name: ceph osd set noscrub
85           tags: step1
86           command: ceph osd set noscrub
87         - name: Stop CephOSD
88           tags: step1
89           service:
90             name: ceph-osd@{{ item }}
91             state: stopped
92           with_items: "{{osd_ids.stdout.strip().split()}}"
93         - name: Update Ceph packages
94           tags: step1
95           yum:
96             name: ceph-osd
97             state: latest
98         - name: Start CephOSD
99           tags: step1
100           service:
101             name: ceph-osd@{{ item }}
102             state: started
103           with_items: "{{osd_ids.stdout.strip().split()}}"
104         # with awk we are meant to check if $2 and $4 are *the same* but it returns 1 when
105         # they are, so the check is inverted to produce an useful exit code
106         - name: Wait for clean pgs...
107           tags: step1,ceph_pgs_clean_validation
108           vars:
109             ignore_warnings: {get_param: IgnoreCephUpgradeWarnings}
110           shell: |
111             ceph pg stat | awk '{exit($2!=$4)}' && ceph health | egrep -sq "HEALTH_OK|HEALTH_WARN"
112           register: ceph_pgs_healthcheck
113           until: ceph_pgs_healthcheck.rc == 0
114           retries: {get_param: CephValidationRetries}
115           delay: {get_param: CephValidationDelay}
116           when:
117             - not ignore_warnings
118         - name: ceph osd unset noout
119           tags: step1
120           command: ceph osd unset noout
121         - name: ceph osd unset norebalance
122           tags: step1
123           command: ceph osd unset norebalance
124         - name: ceph osd unset nodeep-scrub
125           tags: step1
126           command: ceph osd unset nodeep-scrub
127         - name: ceph osd unset noscrub
128           tags: step1
129           command: ceph osd unset noscrub