Page MenuHomePhorge

playbook.yaml
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

playbook.yaml

---
- name: Check local requirements
hosts: localhost
gather_facts: false
any_errors_fatal: true
tasks:
- name: Check if kubectl is available
ansible.builtin.raw: which kubectl
check_mode: false
changed_when: false
failed_when: which_res.rc > 1
register: which_res
- name: Check if kolabctl is available
ansible.builtin.shell:
cmd: env PATH="./:$PATH" which kolabctl
chdir: "{{ inventory_dir }}"
check_mode: false
changed_when: false
failed_when: which_res.rc > 1
register: which_res
- ansible.builtin.set_fact:
kolabctl_path: "{{ which_res.stdout }}"
- name: Assert that we found kolabctl
ansible.builtin.assert:
that: "kolabctl_path"
- name: Configure KVM
hosts: infrastructure_nodes:worker_nodes
gather_facts: false
any_errors_fatal: true
roles:
- role: kvm
when: provision_vm | bool
# We have to run it with serial=1, otherwise it's not executed per host
- name: Update hosts
hosts: infrastructure_nodes:worker_nodes
gather_facts: false
serial: 1
tasks:
- name: Add a host alias so we can connect to the discovered vm ip
ansible.builtin.add_host:
hostname: '{{ inventory_hostname }}'
ansible_host: '{{ vm_ip.stdout }}'
when: provision_vm | bool
- name: Configure kolab-node
hosts: infrastructure_nodes:worker_nodes
gather_facts: false
any_errors_fatal: true
roles:
- kolab-node
- name: Fetch kubeconfig.yaml
hosts: infrastructure_nodes[0]
gather_facts: false
tasks:
- fetch:
flat: true
src: /etc/rancher/k3s/k3s.yaml
dest: "{{ resources_dir }}/kubeconfig.yaml"
- name: Deploy kolab
hosts: localhost
gather_facts: false
roles:
- role: kolab
vars:
primary_ip: "{{ hostvars[groups['infrastructure_nodes'][0]].ansible_host }}"
kubernetes_ip: "{{ virtual_ip }}"
kubeconfig: "{{ resources_dir }}/kubeconfig.yaml"
values_file: "{{ resources_dir }}/values.yaml"
label_nodes: true
reconfigure_env: "DB_ROOT_PASSWORD={{ db_root_password }} DB_KOLAB_PASSWORD={{ db_kolab_password }} DB_ROUNDCUBE_PASSWORD={{ db_rc_password }} DB_HOST={{ virtual_ip }} ADMIN_PASSWORD={{ admin_password }} DOMAIN={{ domain }} DB_MONITORING_PASSWORD={{ db_monitoring_password }} PUBLIC_IP={{ virtual_ip }} TEMPLATE='{{ playbook_dir }}/../values.yaml'"

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 24, 1:16 PM (3 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18842390
Default Alt Text
playbook.yaml (2 KB)

Event Timeline