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:44]
pdonnell [Configuring CephFS Mounts]
devplayground [2026/02/03 22:40] (current)
djgalloway
Line 60: Line 60:
   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 73: 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 93: 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 99: Line 105:
     - name: "2. Configure Ceph client files"     - name: "2. Configure Ceph client files"
       block:       block:
 +        # -----------------------------
 +        # CentOS
 +        # -----------------------------
 +        - name: "​▶️ Install Ceph Squid repo on CentOS"​
 +          ansible.builtin.dnf:​
 +            name: centos-release-ceph-squid.noarch
 +            state: present
 +          when: ansible_facts['​distribution'​] == "​CentOS"​
 +        ​
 +        - name: "​▶️ Install ceph-common on CentOS"​
 +          ansible.builtin.dnf:​
 +            name: ceph-common
 +            state: present
 +          when: ansible_facts['​distribution'​] == "​CentOS"​
 +        ​
 +        # -----------------------------
 +        # Fedora + RHEL (upstream Squid repo)
 +        # -----------------------------
 +        - name: "​▶️ Set Ceph EL major version (Fedora → el9)"
 +          ansible.builtin.set_fact:​
 +            ceph_el_major:​ >-
 +              {{ '​9'​ if ansible_facts['​distribution'​] == '​Fedora'​
 +                 else ansible_facts['​distribution_major_version'​] }}
 +          when: ansible_facts['​distribution'​] in ["​RedHat",​ "​Fedora"​]
 +        ​
 +        - name: "​▶️ Install Ceph Squid upstream repo RPM (via URL)"
 +          ansible.builtin.command:​ >-
 +            dnf -y install
 +            https://​download.ceph.com/​rpm-squid/​el{{ ceph_el_major }}/​noarch/​ceph-release-1-1.el{{ ceph_el_major }}.noarch.rpm
 +          args:
 +            creates: /​etc/​yum.repos.d/​ceph.repo
 +          when: ansible_facts['​distribution'​] in ["​RedHat",​ "​Fedora"​]
 +        ​
 +        - name: "​▶️ Install ceph-common on Fedora / RHEL"
 +          ansible.builtin.dnf:​
 +            name: ceph-common
 +            state: present
 +          when: ansible_facts['​distribution'​] in ["​RedHat",​ "​Fedora"​]
 +
         - name: "​▶️ Ensure /etc/ceph directory exists"​         - name: "​▶️ Ensure /etc/ceph directory exists"​
           ansible.builtin.file:​           ansible.builtin.file:​
Line 111: Line 156:
             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 142: Line 202:
             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 207:
           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.1749577455.txt.gz · Last modified: 2025/06/10 17:44 by pdonnell