blob: e8b782ffd54224fcd149d96efc09b7b3cf1a8669 [file] [log] [blame]
Mohammed Naserb7b97d62022-03-12 16:30:00 -05001# 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 Naser511c3fa2022-03-17 17:54:10 -040015- name: Collect facts for all monitors
Mohammed Naserb7b97d62022-03-12 16:30:00 -050016 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 Naser511c3fa2022-03-17 17:54:10 -040023- name: Create Ceph pool
24 vexxhost.atmosphere.ceph_pool:
Mohammed Naserb7b97d62022-03-12 16:30:00 -050025 name: "{{ ceph_csi_rbd_pool }}"
26 application: rbd
Mohammed Naser511c3fa2022-03-17 17:54:10 -040027 pg_autoscale_mode: "on"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050028
Mohammed Naser511c3fa2022-03-17 17:54:10 -040029- name: Create {{ ceph_csi_rbd_user }} user
30 vexxhost.atmosphere.ceph_key:
Mohammed Naserb7b97d62022-03-12 16:30:00 -050031 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 Naser511c3fa2022-03-17 17:54:10 -040037- name: Retrieve {{ ceph_csi_rbd_user }} keyring
38 vexxhost.atmosphere.ceph_key:
Mohammed Naserb7b97d62022-03-12 16:30:00 -050039 name: "{{ ceph_csi_rbd_user }}"
40 state: info
41 output_format: json
42 register: _ceph_key
43
Mohammed Naser511c3fa2022-03-17 17:54:10 -040044- name: Store keyring inside fact
45 ansible.builtin.set_fact:
Mohammed Naserb7b97d62022-03-12 16:30:00 -050046 _ceph_rbd_csi_ceph_keyring: "{{ _ceph_key.stdout | from_json | first }}"
47
Mohammed Naser511c3fa2022-03-17 17:54:10 -040048- name: Deploy Helm chart
49 kubernetes.core.helm:
Mohammed Naserb7b97d62022-03-12 16:30:00 -050050 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 }}"