ceph: improve cluster setup

Remove separate NetBox lookups. Explicitly allow connections between
cluster nodes. Tigthen temporary allowed IPv6 ranges.
This commit is contained in:
Timotej Lazar 2024-03-01 08:43:15 +01:00
parent 0af8474e52
commit ce7903e43a
5 changed files with 48 additions and 15 deletions

View file

@ -1,17 +1,17 @@
- name: Get all nodes in my cluster
set_fact:
nodes: "{{ groups['cluster_'+cluster] | map('extract', hostvars) }}"
- 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 }}"
comment: "root@{{ inventory_hostname }}"
register: my_key
- name: Deploy my key on other nodes
@ -20,7 +20,7 @@
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') }}"
loop: "{{ nodes | map(attribute='inventory_hostname') }}"
- name: Install required packages
package: