aboutsummaryrefslogtreecommitdiff
path: root/ansible/playbooks
diff options
context:
space:
mode:
authorclyhtsuriva <aimeric@adjutor.xyz>2025-03-03 21:20:59 +0100
committerclyhtsuriva <aimeric@adjutor.xyz>2025-03-03 21:20:59 +0100
commit0182fe51736e7610d4a63fe6767d08ffe5c5938c (patch)
tree0025603ddfb75ae556d1f949be4c7882ea972ee9 /ansible/playbooks
parentf8f9666a8e630d6d64a883bca25ccc4ba98d73e4 (diff)
ansible: add dynamic inventory & playbooks to install k3s hosts
bootstrap.yml will now be used to install any configuration on new provisionned servers, based on tags given by the dynamic inventory
Diffstat (limited to 'ansible/playbooks')
-rw-r--r--ansible/playbooks/bootstrap.yml8
-rw-r--r--ansible/playbooks/docker.yml2
-rw-r--r--ansible/playbooks/k8s.yml5
3 files changed, 10 insertions, 5 deletions
diff --git a/ansible/playbooks/bootstrap.yml b/ansible/playbooks/bootstrap.yml
new file mode 100644
index 0000000..c9d75a4
--- /dev/null
+++ b/ansible/playbooks/bootstrap.yml
@@ -0,0 +1,8 @@
+---
+# Bootstrap playbook for post-provisioning tasks.
+- name: Include Docker playbook if the host has the 'tag_docker' tag
+ ansible.builtin.import_playbook: docker.yml
+
+- name: Include K8s playbook if the host is a k3s master or worker
+ ansible.builtin.import_playbook: k8s.yml
+...
diff --git a/ansible/playbooks/docker.yml b/ansible/playbooks/docker.yml
index 12ff431..ec1bd74 100644
--- a/ansible/playbooks/docker.yml
+++ b/ansible/playbooks/docker.yml
@@ -1,6 +1,6 @@
---
- name: Install Docker on Ubuntu or Debian
- hosts: all
+ hosts: tag_docker
become: true
roles:
- role: docker
diff --git a/ansible/playbooks/k8s.yml b/ansible/playbooks/k8s.yml
index 45f03ee..b3a7e43 100644
--- a/ansible/playbooks/k8s.yml
+++ b/ansible/playbooks/k8s.yml
@@ -1,10 +1,7 @@
---
- name: Deploy a Production Ready Kubernetes Cluster
- hosts: all
+ hosts: tag_k3s_master:tag_k3s_worker
become: true
roles:
- role: k8s
-
-- name: Import kubespray playbook to deploy k8s cluster
- ansible.builtin.import_playbook: ../kubespray/cluster.yml
...