From e7a222f7356e491d7785f18b5b55a0bd3d93cb3f Mon Sep 17 00:00:00 2001 From: erzetpe Date: Tue, 8 Feb 2022 15:06:44 +0100 Subject: [PATCH] Add initial ansible rook role --- .../playbooks/roles/rook/defaults/main.yml | 7 ++++ ansible/playbooks/roles/rook/tasks/main.yml | 36 +++++++++++++++++++ ansible/playbooks/rook.yml | 10 ++++++ 3 files changed, 53 insertions(+) create mode 100644 ansible/playbooks/roles/rook/defaults/main.yml create mode 100644 ansible/playbooks/roles/rook/tasks/main.yml create mode 100644 ansible/playbooks/rook.yml diff --git a/ansible/playbooks/roles/rook/defaults/main.yml b/ansible/playbooks/roles/rook/defaults/main.yml new file mode 100644 index 0000000000..eaf7c8d32a --- /dev/null +++ b/ansible/playbooks/roles/rook/defaults/main.yml @@ -0,0 +1,7 @@ +--- +rook_helm_chart_file_name: rook-ceph-v1.8.1.tgz +rook_chart_namespace: rook-ceph +rook_helm_chart_name: rook-ceph +rook_enabled: true +kubeconfig: + remote: /etc/kubernetes/admin.conf diff --git a/ansible/playbooks/roles/rook/tasks/main.yml b/ansible/playbooks/roles/rook/tasks/main.yml new file mode 100644 index 0000000000..0213c9fc15 --- /dev/null +++ b/ansible/playbooks/roles/rook/tasks/main.yml @@ -0,0 +1,36 @@ +--- +- name: Prepare configuration and upgrade/install Helm chart + when: rook_enabled + become: true + run_once: true + + block: + - name: Download Rook's Chart File + include_role: + name: download + tasks_from: download_file + vars: + file_name: "{{ rook_helm_chart_file_name }}" + + # - name: Copy configuration Helm chart file (custom-chart-values.yml.j2) + # template: + # dest: "{{ download_directory }}/custom-chart-values.yml" + # src: custom-chart-values.yml.j2 + + # - name: Install Rook using Helm chart + # shell: | + # helm -n {{ rook_chart_namespace }} upgrade --install \ + # -f {{ download_directory }}/custom-chart-values.yml \ + # {{ rook_helm_chart_name }} \ + # {{ download_directory }}/{{ rook_helm_chart_file_name }} --create-namespace + # environment: + # KUBECONFIG: "{{ kubeconfig.remote }}" + + - name: Install Rook using Helm chart + shell: | + helm -n {{ rook_chart_namespace }} upgrade --install \ + -f {{ download_directory }}/custom-chart-values.yml \ + {{ rook_helm_chart_name }} \ + {{ download_directory }}/{{ rook_helm_chart_file_name }} --create-namespace + environment: + KUBECONFIG: "{{ kubeconfig.remote }}" diff --git a/ansible/playbooks/rook.yml b/ansible/playbooks/rook.yml new file mode 100644 index 0000000000..4b049b565b --- /dev/null +++ b/ansible/playbooks/rook.yml @@ -0,0 +1,10 @@ +--- +- hosts: all + gather_facts: true + tasks: [] + +- hosts: kubernetes_master + become: true + become_method: sudo + roles: + - rook \ No newline at end of file