Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120835055
playbook.yaml
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
playbook.yaml
View Options
---
-
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
:
-
kvm
# 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
}}'
-
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
tasks
:
-
ansible.builtin.set_fact
:
primary_ip
:
"{{
hostvars[groups['infrastructure_nodes'][0]].ansible_host
}}"
kubeconfig
:
"{{
resources_dir
}}/kubeconfig.yaml"
values_template
:
"{{
playbook_dir
}}/../values.yaml"
values_file
:
"{{
resources_dir
}}/values.yaml"
-
ansible.builtin.shell
:
|
sed -i "s/127.0.0.1/{{ virtual_ip }}/" {{ kubeconfig }}; \
env KUBECONFIG={{ kubeconfig }} kubectl config set-context --namespace=kolab --user=default --cluster=default --current; \
-
name
:
Check kubectl config
ansible.builtin.shell
:
cmd
:
env KUBECONFIG={{ kubeconfig }} kubectl get pods
-
name
:
Apply primary node label
ansible.builtin.shell
:
cmd
:
env KUBECONFIG={{ kubeconfig }} kubectl label nodes {{ hostvars[groups['worker_nodes'][0]].inventory_hostname }} kolab.org/nodegroup=primary
-
name
:
Apply secondary node label
ansible.builtin.shell
:
cmd
:
env KUBECONFIG={{ kubeconfig }} kubectl label nodes {{ hostvars[groups['worker_nodes'][1]].inventory_hostname }} kolab.org/nodegroup=secondary
-
name
:
Prepare k3s
ansible.builtin.shell
:
cmd
:
env KUBECONFIG={{ kubeconfig }} {{ kolabctl_path }} k3s-setup
ignore_errors
:
true
# Delete existing ingressclass, otherwise we can't apply our chart with the subcharts, which tries to create the same ingressclass
-
ansible.builtin.shell
:
cmd
:
env KUBECONFIG={{ kubeconfig }} kubectl delete ingressclass/haproxy
ignore_errors
:
true
-
ansible.builtin.shell
:
cmd
:
env IMAGE_REGISTRY={{ primary_ip }}:5001 IMAGE_VERSION=latest 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="{{ values_template }}" {{ kolabctl_path }} reconfigure
chdir
:
"{{
resources_dir
}}"
creates
:
values.yaml
when
:
local_registry
-
ansible.builtin.shell
:
cmd
:
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="{{ values_template }}" {{ kolabctl_path }} reconfigure
chdir
:
"{{
resources_dir
}}"
creates
:
values.yaml
when
:
not local_registry
-
name
:
"Deploying
kolab"
ansible.builtin.shell
:
cmd
:
env KUBECONFIG={{ kubeconfig }} CHART_URL={{ chart_url }} {{ kolabctl_path }} apply --force
chdir
:
"{{
resources_dir
}}"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 24, 1:12 PM (6 d, 6 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18839569
Default Alt Text
playbook.yaml (4 KB)
Attached To
Mode
R114 kolab-infrastructure
Attached
Detach File
Event Timeline