All the Ansible playbooks used to deploy k3s, argo server, admiralty and minio
This commit is contained in:
49
ansible/Admiralty/add_admiralty_target.yml
Normal file
49
ansible/Admiralty/add_admiralty_target.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
- name: Setup an exsiting k8s cluster to become an admiralty worker for Argo Workflows
|
||||
hosts: all:!localhost
|
||||
user: "{{ user_prompt }}"
|
||||
vars:
|
||||
- service_account_name: "{{ serviceaccount_prompt }}"
|
||||
- namespace: "{{ namespace_source }}"
|
||||
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Store kubeconfig value
|
||||
ansible.builtin.set_fact:
|
||||
kubeconfig: "{{ lookup('file','worker_kubeconfig/{{ target_ip }}_kubeconfig.json') | trim }}"
|
||||
|
||||
- name: Create the serviceAccount that will execute in the target
|
||||
kubernetes.core.k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: '{{ service_account_name }}'
|
||||
namespace: '{{ namespace }}'
|
||||
|
||||
- name: Create the token to authentify source
|
||||
kubernetes.core.k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: Opaque
|
||||
metadata:
|
||||
name: admiralty-secret-{{ target_name }}
|
||||
namespace: "{{ namespace_source }}"
|
||||
data:
|
||||
config: "{{ kubeconfig | tojson | b64encode }}"
|
||||
|
||||
- name: Create the target ressource
|
||||
kubernetes.core.k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: multicluster.admiralty.io/v1alpha1
|
||||
kind: Target
|
||||
metadata:
|
||||
name: target-{{ target_name }}
|
||||
namespace: '{{ namespace_source }}'
|
||||
spec:
|
||||
kubeconfigSecret:
|
||||
name: admiralty-secret-{{ target_name }}
|
||||
Reference in New Issue
Block a user