Page MenuHomePhorge

playbook.yaml
No OneTemporary

Authored By
Unknown
Size
3 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: Init password
hosts: infrastructure_nodes:worker_nodes
gather_facts: false
any_errors_fatal: true
roles:
- password-init
- name: Setup storage
hosts: infrastructure_nodes:worker_nodes
gather_facts: true
any_errors_fatal: true
tasks:
- name: Make filesystem on device
community.general.filesystem:
fstype: xfs
dev: "{{ item['device'] }}"
loop: "{{ disks }}"
when: disks is defined
- name: Mount device
ansible.posix.mount:
path: "{{ item['mountpoint'] }}"
src: "{{ item['device'] }}"
fstype: xfs
opts: noatime
state: mounted
loop: "{{ disks }}"
when: disks is defined
- name: Configure kolab-node
hosts: infrastructure_nodes:worker_nodes
gather_facts: false
any_errors_fatal: true
roles:
- role: kolab-single-node
vars:
primary_ip: "{{ hostvars[groups['infrastructure_nodes'][0]].ansible_host }}"
- 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: "{{ hostvars[groups['infrastructure_nodes'][0]].ansible_host }}"
kubeconfig: "{{ resources_dir }}/kubeconfig.yaml"
values_file: "{{ resources_dir }}/values.yaml"
label_nodes: false
reconfigure_env: >-
ADMIN_PASSWORD={{ admin_password }}
DOMAIN={{ domain }}
PRIMARY_IP={{ primary_ip }}
PUBLIC_IP={{ public_ip | default(primary_ip) }}
TEMPLATE='{{ playbook_dir }}/../values.yaml'

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 24, 1:31 PM (11 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18829438
Default Alt Text
playbook.yaml (3 KB)

Event Timeline