ganeti-ansible/roles/master/tasks/main.yml

38 lines
1.1 KiB
YAML
Raw Normal View History

2024-11-26 14:56:58 +00:00
- name: Check if the cluster is intalized
ansible.builtin.command:
cmd: gnt-cluster info
ignore_errors: true
changed_when: false
register: ganeti_cluster_initalized
- name: Initalize cluster
ansible.builtin.command:
cmd: |-
gnt-cluster init
--enabled-hypervisors kvm
--no-etc-hosts
--master-netdev {{ bridge_name }}
--nic-parameters link={{ bridge_name }},mode=bridged
--enabled-disk-templates drbd,plain
{{ cluster_name }}
register: ganeti_cluster_init_result
changed_when: ganeti_cluster_init_result.rc == 0
when: ganeti_cluster_initalized.rc != 0
- name: Add worker {{ item }}
ansible.builtin.command:
cmd: |-
bash -c "
(gnt-node list | grep 'ganeti-{{ groups['nodes'].index(item) + 1 }}.ganeti') || \
gnt-node add \
--no-ssh-key-check \
--no-node-setup \
ganeti-{{ groups['nodes'].index(item) + 1 }}.ganeti"
register: node_add_result
changed_when: node_add_result.rc == 0
loop: "{{ groups['workers'] }}"
- name: Install ZFS extstorage
ansible.builtin.include_role:
name: zfs-extstorage