Add ceph role
Just prepares the servers, all management is then done through cephadm.
This commit is contained in:
parent
832be31e21
commit
5038411af3
6 changed files with 106 additions and 0 deletions
16
roles/ceph/tasks/firewall.yml
Normal file
16
roles/ceph/tasks/firewall.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
- name: Install nftables
|
||||
package:
|
||||
name: nftables
|
||||
|
||||
- name: Configure nftables
|
||||
template:
|
||||
dest: /etc/nftables.conf
|
||||
src: nftables.conf.j2
|
||||
mode: 0644
|
||||
notify: reload nftables
|
||||
|
||||
- name: Enable nftables
|
||||
service:
|
||||
name: nftables
|
||||
enabled: true
|
||||
state: started
|
38
roles/ceph/tasks/main.yml
Normal file
38
roles/ceph/tasks/main.yml
Normal file
|
@ -0,0 +1,38 @@
|
|||
- 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
|
Loading…
Add table
Add a link
Reference in a new issue