User Tools

Site Tools


devplayground

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devplayground [2025/06/10 17:25]
pdonnell [Configuring CephFS Mounts]
devplayground [2025/12/17 22:16] (current)
pdonnell [Configuring CephFS Mounts]
Line 54: Line 54:
 The following ansible playbook can be run to setup CephFS mounts on a new developer playground machines: The following ansible playbook can be run to setup CephFS mounts on a new developer playground machines:
  
-<​code>​---+<​code>​ 
 +---
 - name: Configure Ceph Client and Mounts - name: Configure Ceph Client and Mounts
   hosts: all   hosts: all
   become: true   become: true
   vars:   vars:
-    admin_node: "reesi003.front.sepia.ceph.com"​+    admin_node: "doli01.front.sepia.ceph.com"​
     ceph_conf_path:​ "/​etc/​ceph/​ceph.conf"​     ceph_conf_path:​ "/​etc/​ceph/​ceph.conf"​
     keyring_path:​ "/​etc/​ceph/​client.sepian.keyring"​     keyring_path:​ "/​etc/​ceph/​client.sepian.keyring"​
 +    client_keyring_path:​ "/​etc/​ceph/​keyring"​
     secret_path:​ "/​etc/​ceph/​client.sepian.secret"​     secret_path:​ "/​etc/​ceph/​client.sepian.secret"​
     mounts:     mounts:
       - { path: "/​teuthology",​ fstype: "​ceph",​ src: "/​teuthology-archive",​ mds_namespace:​ "​teuthology",​ opts: "​_netdev,​ro"​ }       - { path: "/​teuthology",​ fstype: "​ceph",​ src: "/​teuthology-archive",​ mds_namespace:​ "​teuthology",​ opts: "​_netdev,​ro"​ }
       - { path: "/​scratch",​ fstype: "​ceph",​ src: "/",​ mds_namespace:​ "​scratch",​ opts: "​_netdev"​ }       - { path: "/​scratch",​ fstype: "​ceph",​ src: "/",​ mds_namespace:​ "​scratch",​ opts: "​_netdev"​ }
-      - { path: "/​postfile",​ fstype: "​ceph",​ src: "/",​ mds_namespace:​ "​postfile",​ opts: "​_netdev,​ro"​ } 
  
   tasks:   tasks:
Line 72: Line 73:
       delegate_to:​ "{{ admin_node }}"       delegate_to:​ "{{ admin_node }}"
       block:       block:
 +        - name: "​▶️ Get LRC fsid"
 +          ansible.builtin.raw:​ >
 +            env CEPH_KEYRING={{ keyring_path }} ceph --id sepian fsid
 +          register: ceph_fsid
 +          changed_when:​ false
 +
         - name: "​▶️ Generate minimal ceph.conf (raw)"         - name: "​▶️ Generate minimal ceph.conf (raw)"
           ansible.builtin.raw:​ >           ansible.builtin.raw:​ >
-            env CEPH_KEYRING=/​etc/​ceph/​client.sepian.keyring ​ceph --id sepian config generate-minimal-conf+            env CEPH_KEYRING={{ keyring_path }} ceph --id sepian config generate-minimal-conf
           register: ceph_conf_content           register: ceph_conf_content
           changed_when:​ false           changed_when:​ false
Line 92: Line 99:
         - name: "​▶️ Get Ceph monitor list (raw)"         - name: "​▶️ Get Ceph monitor list (raw)"
           ansible.builtin.raw:​ >           ansible.builtin.raw:​ >
-            env CEPH_KEYRING=/​etc/​ceph/​client.sepian.keyring ​ceph --id sepian mon dump --format json 2>/​dev/​null | jq -r '​[.mons[] | .public_addrs.addrvec[] | select(.type=="​v1"​).addr] | join(","​)'​+            env CEPH_KEYRING={{ keyring_path }} ceph --id sepian mon dump --format json 2>/​dev/​null | jq -r '​[.mons[] | .public_addrs.addrvec[] | select(.type=="​v1"​).addr] | join(","​)'​
           register: mon_hosts           register: mon_hosts
           changed_when:​ false           changed_when:​ false
Line 110: Line 117:
             mode: '​0644'​             mode: '​0644'​
  
-        - name: "​▶️ ​Deploy client ​keyring"​+        - name: "​▶️ ​Create temporary file for keyring ​import"​ 
 +          ansible.builtin.tempfile:​ 
 +            state: file 
 +            suffix: .keyring 
 +          register: tmp_keyring 
 + 
 +        - name: "​▶️ Write keyring content to temporary file"
           ansible.builtin.copy:​           ansible.builtin.copy:​
             content: "{{ keyring_content.stdout }}"             content: "{{ keyring_content.stdout }}"
-            dest: "​{{ ​keyring_path ​}}" +            dest: "​{{ ​tmp_keyring.path ​}}" 
-            mode: '0644'+            mode: '0600' 
 + 
 +        - name: "​▶️ Deploy client keyring"​ 
 +          ansible.builtin.raw:​ > 
 +            ceph-authtool {{ client_keyring_path }} --create-keyring --import-keyring {{ tmp_keyring.path }} 
 + 
 +        - name: "​▶️ Clean up temporary keyring file"​ 
 +          ansible.builtin.file:​ 
 +            path: "{{ tmp_keyring.path }}" 
 +            state: absent
  
         - name: "​▶️ Deploy client secret file (for other tools)"​         - name: "​▶️ Deploy client secret file (for other tools)"​
Line 124: Line 146:
     - name: "3. Set up CephFS mounts"​     - name: "3. Set up CephFS mounts"​
       block:       block:
 +        - name: "​▶️ Install ceph-common on Ubuntu/​Debian"​
 +          ansible.builtin.apt:​
 +            name: ceph-common
 +            state: present
 +            update_cache:​ yes
 +          when: ansible_facts['​os_family'​] == "​Debian"​
 +
 +        - name: "​▶️ Install Ceph Squid repo on RHEL derivatives"​
 +          ansible.builtin.dnf:​
 +            name: centos-release-ceph-squid.noarch
 +            state: present
 +          when: ansible_facts['​os_family'​] == "​RedHat"​
 +
 +        - name: "​▶️ Install ceph-common on RHEL derivatives"​
 +          ansible.builtin.dnf:​
 +            name: ceph-common
 +            state: present
 +          when: ansible_facts['​os_family'​] == "​RedHat"​
 +
         - name: "​▶️ Unmount filesystems if they currently exist"         - name: "​▶️ Unmount filesystems if they currently exist"
           ansible.posix.mount:​           ansible.posix.mount:​
Line 129: Line 170:
             state: unmounted             state: unmounted
           loop: "{{ mounts }}"           loop: "{{ mounts }}"
-          ignore_errors:​ true 
  
-        - name: "​▶️ Create mount point directories ​and set immutable"+        - name: "​▶️ Create mount point directories"​
           ansible.builtin.file:​           ansible.builtin.file:​
             path: "{{ item.path }}"             path: "{{ item.path }}"
Line 142: Line 182:
             path: "{{ item.path }}"             path: "{{ item.path }}"
             attr: +i             attr: +i
-          register: immutable_file 
-          changed_when:​ "'​i'​ not in immutable_file.diff.before.attributes"​ 
           loop: "{{ mounts }}"           loop: "{{ mounts }}"
  
Line 149: Line 187:
           ansible.posix.mount:​           ansible.posix.mount:​
             path: "{{ item.path }}"             path: "{{ item.path }}"
-            src: "​{{ ​mon_hosts.stdout | trim }}:{{ item.src }}"+            src: "sepian@{{ ceph_fsid.stdout | trim }}.{{ item.mds_namespace }}={{ item.src }}"
             fstype: "{{ item.fstype }}"             fstype: "{{ item.fstype }}"
-            opts: "name=sepian,​secret={{ secret_content.stdout | trim }},​mds_namespace={{ item.mds_namespace }},{{ item.opts }}"+            opts: "{{ item.opts }}"
             state: mounted             state: mounted
-            dump: 2 +            dump: 0 
-            passno: ​2+            passno: ​0
           loop: "{{ mounts }}"           loop: "{{ mounts }}"
           notify: Reload Systemd           notify: Reload Systemd
devplayground.1749576313.txt.gz · Last modified: 2025/06/10 17:25 by pdonnell