summaryrefslogtreecommitdiff
path: root/playbooks/roles/ceph/tasks/main.yml
blob: b55434067053909879b1bb5ee42a6b9bb5bd5747 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---

- name: Install Ceph Packages
  ansible.builtin.apt:
    name:
      - ceph-common
      - ceph-fuse
    state: present
  
- name: Copy Ceph Configuration
  ansible.builtin.copy:
    content: |
      [global]
      fsid = {{ ceph_fsid }}
      mon_host = {{ ceph_mon_host }}
    dest: /etc/ceph/ceph.conf
    mode: '0644'
  
- name: Copy Ceph Keyring
  ansible.builtin.copy:
    content: |
      [client.{{ ceph_client_name }}]
      key = {{ ceph_secret }}
    dest: "/etc/ceph/ceph.client.{{ ceph_client_name }}.keyring"
    mode: '0600'
  
- name: Ensure Ceph Base Exists
  ansible.builtin.file:
    path: "{{ ceph_base }}"
    owner: root
    group: root
    state: directory
    recurse: true
  
- name: Mount Ceph on Boot
  ansible.builtin.lineinfile:
    path: /etc/fstab
    regexp: '{{ ceph_base }}\w+fuse.ceph'
    line: "none {{ ceph_base }} fuse.ceph ceph.id={{ ceph_client_name }},_netdev,defaults 0 0"
    create: true
    mode: "0644"
  
- name: Mount Ceph Now
  ansible.builtin.command: mount -a