servers/roles/ceph/tasks/main.yml
Timotej Lazar 5038411af3 Add ceph role
Just prepares the servers, all management is then done through cephadm.
2023-11-20 13:04:11 +01:00

39 lines
1.1 KiB
YAML

- name: Configure /etc/hosts
template:
dest: /etc/hosts
src: hosts.j2
- name: Get cluster
set_fact:
cluster: "{{ query('netbox.netbox.nb_lookup', 'clusters', raw_data=true, api_filter='name='~cluster) | first }}"
- name: Generate my SSH key
openssh_keypair:
path: /root/.ssh/id_ed25519
type: ed25519
comment: "root@{{ ansible_hostname }}"
register: my_key
- name: Deploy my key on other nodes
authorized_key:
user: root
key: "{{ my_key.public_key }}"
comment: "{{ my_key.comment }}"
delegate_to: "{{ item }}"
loop: "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='cluster_id='~cluster.id, raw_data=true) | map(attribute='name') }}"
- name: Install required packages
package:
name:
- lvm2
- podman
- name: Install cephadm script
get_url:
url: https://download.ceph.com/rpm-{{ ceph_version }}/el9/noarch/cephadm
checksum: sha512:dc9bfed5b56c3756720e935a1520ccffe4ecf5e37502fe60a6ff835b98da8afe23a0ecab3770698c10ce1278004c788091eed9b4651d1c52f8d05729b4036c12
dest: /usr/local/bin/cephadm
mode: 0755
- include_tasks: firewall.yml