Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/tests/winery/ceph.yml
- This file was added.
| # | |||||
| # notes to install a client | |||||
| # https://docs.ceph.com/en/latest/cephadm/client-setup/ | |||||
| # ceph config generate-minimal-conf > /etc/ceph/ceph.conf | |||||
| # ceph auth get-or-create client.admin > /etc/ceph/ceph.keyring | |||||
| # | |||||
| - hosts: localhost | |||||
| gather_facts: false | |||||
| pre_tasks: | |||||
| - name: keygen ceph_key | |||||
| shell: | | |||||
| ssh-keygen -f ceph_key -N '' -t rsa | |||||
| args: | |||||
| creates: ceph_key | |||||
| - hosts: all | |||||
| become: true | |||||
| pre_tasks: | |||||
| - name: mkdir /root/.ssh | |||||
| file: | |||||
| path: /root/.ssh | |||||
| state: directory | |||||
| mode: 700 | |||||
| - name: touch /root/.ssh/authorized_keys | |||||
| file: | |||||
| path: /root/.ssh/authorized_keys | |||||
| state: touch | |||||
| - name: add ceph_key.pub to /root/.ssh/authorized_keys | |||||
| lineinfile: | |||||
| path: /root/.ssh/authorized_keys | |||||
| line: "{{ lookup('file', 'ceph_key.pub') }}" | |||||
| - name: apt install | |||||
| apt: | |||||
| name: | |||||
| - htop | |||||
| - iotop | |||||
| - iftop | |||||
| - iperf | |||||
| - hosts: ceph | |||||
| become: true | |||||
| pre_tasks: | |||||
| - name: apt install lvm2 curl gnupg2 | |||||
| apt: | |||||
| name: | |||||
| - lvm2 | |||||
| - curl | |||||
| - gnupg2 | |||||
| - name: apt-key https://download.ceph.com/keys/release.asc | |||||
| apt_key: | |||||
| url: https://download.ceph.com/keys/release.asc | |||||
| - name: add repository | |||||
| apt_repository: | |||||
| repo: "deb https://download.ceph.com/debian-pacific/ bullseye main" | |||||
| filename: ceph | |||||
| - name: apt install cephadm ceph-common | |||||
| apt: | |||||
| name: | |||||
| - cephadm | |||||
| - ceph-common | |||||
| roles: | |||||
| - geerlingguy.docker | |||||
| - hosts: all | |||||
| become: true | |||||
| tasks: | |||||
| - name: "add {{ inventory_hostname }} to /etc/hosts" | |||||
| lineinfile: | |||||
| path: /etc/hosts | |||||
| line: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} {{ inventory_hostname }}" | |||||
| delegate_to: ceph1 | |||||
| - name: set hostname | |||||
| hostname: | |||||
| name: "{{ inventory_hostname }}" | |||||
| - hosts: mon | |||||
| become: true | |||||
| tasks: | |||||
| - name: scp ceph_key.* | |||||
| copy: | |||||
| src: "{{ item }}" | |||||
| dest: "{{ item }}" | |||||
| loop: | |||||
| - ceph_key | |||||
| - ceph_key.pub | |||||
| - name: cephadm bootstrap | |||||
| shell: | | |||||
| set -ex | |||||
| cephadm bootstrap --mon-ip {{ hostvars[groups['mon'][0]]['ansible_default_ipv4']['address'] }} | |||||
| cephadm shell ceph cephadm clear-key | |||||
| ceph config-key set mgr/cephadm/ssh_identity_key -i ceph_key | |||||
| ceph config-key set mgr/cephadm/ssh_identity_pub -i ceph_key.pub | |||||
| ceph orch apply osd --all-available-devices | |||||
| args: | |||||
| creates: /etc/ceph/ceph.pub | |||||
| - name: ceph configuration | |||||
| shell: | | |||||
| set -ex | |||||
| ceph config set mon mon_allow_pool_delete true | |||||
| # does not work for some reason: must be done manually | |||||
| cephadm shell ceph mgr fail # required for mgr/cephadm/ssh_identity* to be refreshed | |||||