|
| 1 | +overrides: |
| 2 | + ceph: |
| 3 | + log-ignorelist: |
| 4 | + - CEPHADM_FAILED_DAEMON |
| 5 | + log-only-match: |
| 6 | + - CEPHADM_ |
| 7 | +roles: |
| 8 | +- - host.a |
| 9 | + - mon.a |
| 10 | + - mgr.a |
| 11 | + - osd.0 |
| 12 | +- - host.b |
| 13 | + - mon.b |
| 14 | + - mgr.b |
| 15 | + - osd.1 |
| 16 | +- - host.c |
| 17 | + - mon.c |
| 18 | + - osd.2 |
| 19 | +tasks: |
| 20 | +- install: |
| 21 | +- cephadm: |
| 22 | +- cephadm.shell: |
| 23 | + host.c: |
| 24 | + - | |
| 25 | + set -ex |
| 26 | + # Deploy monitoring stack |
| 27 | + ceph orch apply node-exporter |
| 28 | + ceph orch apply grafana |
| 29 | + ceph orch apply alertmanager |
| 30 | + ceph orch apply prometheus |
| 31 | + sleep 240 |
| 32 | + # generate SSL certificate |
| 33 | + openssl req -x509 -newkey rsa:4096 -keyout /tmp/key.pem -out /tmp/cert.pem -sha256 -days 30 -nodes -subj "/CN=*" |
| 34 | + # Generate a mgmt.spec template |
| 35 | + cat << EOT > /tmp/mgmt.spec |
| 36 | + service_type: mgmt-gateway |
| 37 | + service_id: foo |
| 38 | + placement: |
| 39 | + hosts: |
| 40 | + - ${HOSTNAME} |
| 41 | + spec: |
| 42 | + ssl_protocols: |
| 43 | + - TLSv1.2 |
| 44 | + - TLSv1.3 |
| 45 | + ssl_ciphers: |
| 46 | + - AES128-SHA |
| 47 | + - AES256-SHA |
| 48 | + enable_health_check_endpoint: True |
| 49 | + EOT |
| 50 | + # Add generated certificates to spec file |
| 51 | + echo " ssl_certificate: |" >> /tmp/mgmt.spec |
| 52 | + while read LINE; do echo $LINE | sed -e "s/^/ /"; done < /tmp/cert.pem >> /tmp/mgmt.spec |
| 53 | + echo " ssl_certificate_key: |" >> /tmp/mgmt.spec |
| 54 | + while read LINE; do echo $LINE | sed -e "s/^/ /"; done < /tmp/key.pem >> /tmp/mgmt.spec |
| 55 | + # Apply spec |
| 56 | + ceph orch apply -i /tmp/mgmt.spec |
| 57 | +- cephadm.wait_for_service: |
| 58 | + service: mgmt-gateway |
| 59 | +- cephadm.shell: |
| 60 | + host.a: |
| 61 | + - | |
| 62 | + set -ex |
| 63 | + # retrieve mgmt hostname and ip |
| 64 | + MGMT_GTW_HOST=$(ceph orch ps --daemon-type mgmt-gateway -f json | jq -e '.[]' | jq -r '.hostname') |
| 65 | + MGMT_GTW_IP=$(ceph orch host ls -f json | jq -r --arg MGMT_GTW_HOST "$MGMT_GTW_HOST" '.[] | select(.hostname==$MGMT_GTW_HOST) | .addr') |
| 66 | + # check mgmt-gateway health |
| 67 | + curl -k -s https://${MGMT_GTW_IP}/health |
| 68 | + curl -k -s https://${MGMT_GTW_IP}:29443/health |
| 69 | + # wait for background services to be reconfigured following mgmt-gateway installation |
| 70 | + sleep 180 |
| 71 | + # check grafana endpoints are responsive and database health is okay |
| 72 | + curl -k -s https://${MGMT_GTW_IP}/grafana/api/health | jq -e '.database == "ok"' |
| 73 | + # check prometheus endpoints are responsive |
| 74 | + curl -k -s -u admin:admin https://${MGMT_GTW_IP}/prometheus/api/v1/status/config | jq -e '.status == "success"' |
| 75 | + # check alertmanager endpoints are responsive |
| 76 | + curl -k -s -u admin:admin https://${MGMT_GTW_IP}/alertmanager/api/v2/status |
| 77 | +
|
0 commit comments