Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 1 | # Copyright (c) 2022 VEXXHOST, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 15 | - name: Collect facts for all monitors |
Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 16 | run_once: true |
| 17 | delegate_to: "{{ item }}" |
| 18 | delegate_facts: true |
| 19 | ansible.builtin.setup: |
| 20 | gather_subset: network |
| 21 | loop: "{{ groups[ceph_csi_rbd_mons_group] }}" |
| 22 | |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 23 | - name: Create Ceph pool |
| 24 | vexxhost.atmosphere.ceph_pool: |
Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 25 | name: "{{ ceph_csi_rbd_pool }}" |
| 26 | application: rbd |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 27 | pg_autoscale_mode: "on" |
Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 28 | |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 29 | - name: Create {{ ceph_csi_rbd_user }} user |
| 30 | vexxhost.atmosphere.ceph_key: |
Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 31 | name: "{{ ceph_csi_rbd_user }}" |
| 32 | caps: |
| 33 | mon: profile rbd |
| 34 | mgr: profile rbd pool={{ ceph_csi_rbd_pool }} |
| 35 | osd: profile rbd pool={{ ceph_csi_rbd_pool }} |
| 36 | |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 37 | - name: Retrieve {{ ceph_csi_rbd_user }} keyring |
| 38 | vexxhost.atmosphere.ceph_key: |
Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 39 | name: "{{ ceph_csi_rbd_user }}" |
| 40 | state: info |
| 41 | output_format: json |
| 42 | register: _ceph_key |
| 43 | |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 44 | - name: Store keyring inside fact |
| 45 | ansible.builtin.set_fact: |
Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 46 | _ceph_rbd_csi_ceph_keyring: "{{ _ceph_key.stdout | from_json | first }}" |
| 47 | |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 48 | - name: Deploy Helm chart |
| 49 | kubernetes.core.helm: |
Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 50 | name: ceph-csi-rbd |
| 51 | chart_ref: ceph/ceph-csi-rbd |
| 52 | chart_version: 3.5.1 |
| 53 | release_namespace: kube-system |
| 54 | kubeconfig: /etc/kubernetes/admin.conf |
| 55 | values: |
| 56 | csiConfig: |
| 57 | - clusterID: "{{ ceph_mon_fsid }}" |
| 58 | monitors: "{{ groups[ceph_csi_rbd_mons_group] | map('extract', hostvars, ['ansible_default_ipv4', 'address']) }}" |
| 59 | nodeplugin: |
| 60 | httpMetrics: |
| 61 | containerPort: 8081 |
| 62 | provisioner: |
| 63 | nodeSelector: |
| 64 | openstack-control-plane: enabled |
| 65 | storageClass: |
| 66 | create: true |
| 67 | name: general |
| 68 | annotations: |
| 69 | storageclass.kubernetes.io/is-default-class: "true" |
| 70 | clusterID: "{{ ceph_csi_rbd_ceph_fsid }}" |
| 71 | pool: "{{ ceph_csi_rbd_pool }}" |
| 72 | mountOptions: |
| 73 | - discard |
| 74 | secret: |
| 75 | create: true |
| 76 | userID: "{{ ceph_csi_rbd_id }}" |
| 77 | userKey: "{{ _ceph_rbd_csi_ceph_keyring.key }}" |