infra/home/ansible/mount-cephfs-k8s.yml
2025-09-06 10:55:13 -05:00

35 lines
No EOL
981 B
YAML

---
- name: Configure CephFS access on K3s nodes
hosts: k3s_cluster
become: true
tasks:
- name: Install ceph-fuse package for CephFS
package:
name:
- ceph-fuse
- ceph-common
state: present
ignore_errors: yes
register: ceph_install
- name: Create mount point for testing
file:
path: /mnt/cephfs-test
state: directory
mode: '0755'
- name: Test CephFS mount
shell: |
timeout 5 ceph-fuse -n client.kubernetes --keyring=/etc/ceph/ceph.client.kubernetes.keyring -m 10.0.16.231:6789,10.0.16.232:6789,10.0.16.233:6789 /mnt/cephfs-test
register: mount_test
failed_when: false
changed_when: false
- name: Unmount test
shell: fusermount -u /mnt/cephfs-test
failed_when: false
changed_when: false
- name: Show mount test result
debug:
msg: "CephFS mount test: {{ 'SUCCESS' if mount_test.rc == 124 else 'FAILED' }}"