ansible-collection-atmosphere/roles/ceph_csi_rbd/tasks/main.yml

78 lines
2.4 KiB
YAML

# Copyright (c) 2022 VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Collect facts for all monitors
run_once: true
delegate_to: "{{ item }}"
delegate_facts: true
ansible.builtin.setup:
gather_subset: network
loop: "{{ groups[ceph_csi_rbd_mons_group] }}"
- name: Create Ceph pool
vexxhost.atmosphere.ceph_pool:
name: "{{ ceph_csi_rbd_pool }}"
application: rbd
pg_autoscale_mode: "on"
- name: Create {{ ceph_csi_rbd_user }} user
vexxhost.atmosphere.ceph_key:
name: "{{ ceph_csi_rbd_user }}"
caps:
mon: profile rbd
mgr: profile rbd pool={{ ceph_csi_rbd_pool }}
osd: profile rbd pool={{ ceph_csi_rbd_pool }}
- name: Retrieve {{ ceph_csi_rbd_user }} keyring
vexxhost.atmosphere.ceph_key:
name: "{{ ceph_csi_rbd_user }}"
state: info
output_format: json
register: _ceph_key
- name: Store keyring inside fact
ansible.builtin.set_fact:
_ceph_rbd_csi_ceph_keyring: "{{ _ceph_key.stdout | from_json | first }}"
- name: Deploy Helm chart
kubernetes.core.helm:
name: ceph-csi-rbd
chart_ref: ceph/ceph-csi-rbd
chart_version: 3.5.1
release_namespace: kube-system
kubeconfig: /etc/kubernetes/admin.conf
values:
csiConfig:
- clusterID: "{{ ceph_mon_fsid }}"
monitors: "{{ groups[ceph_csi_rbd_mons_group] | map('extract', hostvars, ['ansible_default_ipv4', 'address']) }}"
nodeplugin:
httpMetrics:
containerPort: 8081
provisioner:
nodeSelector:
openstack-control-plane: enabled
storageClass:
create: true
name: general
annotations:
storageclass.kubernetes.io/is-default-class: "true"
clusterID: "{{ ceph_csi_rbd_ceph_fsid }}"
pool: "{{ ceph_csi_rbd_pool }}"
mountOptions:
- discard
secret:
create: true
userID: "{{ ceph_csi_rbd_id }}"
userKey: "{{ _ceph_rbd_csi_ceph_keyring.key }}"