From 69655613399180247cb592e154103b4a491723ce Mon Sep 17 00:00:00 2001 From: Maarten de Waard <maarten@greenhost.nl> Date: Fri, 20 Mar 2020 11:20:43 +0100 Subject: [PATCH] correctly use file lookup plugin, read local storage definition from symlink --- ansible/roles/apps/files/local-storage.yaml | 1 + ansible/roles/apps/tasks/flux.yml | 68 ++++++++++++++------- ansible/roles/apps/tasks/local-storage.yml | 17 ------ ansible/roles/apps/tasks/main.yml | 5 +- 4 files changed, 48 insertions(+), 43 deletions(-) create mode 120000 ansible/roles/apps/files/local-storage.yaml delete mode 100644 ansible/roles/apps/tasks/local-storage.yml diff --git a/ansible/roles/apps/files/local-storage.yaml b/ansible/roles/apps/files/local-storage.yaml new file mode 120000 index 000000000..06a8699c2 --- /dev/null +++ b/ansible/roles/apps/files/local-storage.yaml @@ -0,0 +1 @@ +../../../../flux/local-storage.yaml \ No newline at end of file diff --git a/ansible/roles/apps/tasks/flux.yml b/ansible/roles/apps/tasks/flux.yml index 4138fc5ae..7419bab0a 100644 --- a/ansible/roles/apps/tasks/flux.yml +++ b/ansible/roles/apps/tasks/flux.yml @@ -1,5 +1,51 @@ --- +- name: Install helm-operator + tags: + - flux + # Commented version of below shell command: + # helm upgrade + # # Install a new release if it doesn't yet exist. + # --install + # --repo "https://charts.fluxcd.io" + # --namespace oas + # --version 0.3.0 + # --set createCRD=true + # # Reconcile actual helm releases with HelmRelease objects with this + # # interval. + # --set chartsSyncInterval=20m + # # Update HelmRelease objects' status with this interval. + # --set statusUpdateInterval=30s + # # Helm release name + # helm-operator + # # Chart name + # helm-operator + shell: helm upgrade --install --repo "https://charts.fluxcd.io" --namespace oas --version 0.3.0 --set createCRD=true --set chartsSyncInterval=20m --set statusUpdateInterval=30s helm-operator helm-operator +- name: Create Kubernetes secret with local-storage settings + tags: + - config + - flux + - local-storage + vars: + flux: + name: "local-storage-settings" + namespace: "oas" + include_tasks: + file: flux_secret.yml + apply: + tags: + - config + - flux + - local-storage + +- name: Create local-storage HelmResource + tags: + - config + - flux + - local-storage + k8s: + state: present + resource_definition: "{{ lookup('file', 'local-storage.yaml') | from_yaml }}" - name: Install flux tags: @@ -40,28 +86,6 @@ # flux shell: helm upgrade --install --repo "https://charts.fluxcd.io" --namespace oas --version 0.16.0 --set git.url="{{ git_url }}" --set git.branch="{{ git_branch }}" --set git.path="{{ git_path }}" --set git.readonly=true --set registry.excludeImage='*' --set sync.state="secret" --set syncGarbageCollection.enabled=true --set git.pollInterval=1h flux flux -- name: Install helm-operator - tags: - - flux - # Commented version of below shell command: - # helm upgrade - # # Install a new release if it doesn't yet exist. - # --install - # --repo "https://charts.fluxcd.io" - # --namespace oas - # --version 0.3.0 - # --set createCRD=true - # # Reconcile actual helm releases with HelmRelease objects with this - # # interval. - # --set chartsSyncInterval=20m - # # Update HelmRelease objects' status with this interval. - # --set statusUpdateInterval=30s - # # Helm release name - # helm-operator - # # Chart name - # helm-operator - shell: helm upgrade --install --repo "https://charts.fluxcd.io" --namespace oas --version 0.3.0 --set createCRD=true --set chartsSyncInterval=20m --set statusUpdateInterval=30s helm-operator helm-operator - - name: Install fluxctl via snap tags: - flux diff --git a/ansible/roles/apps/tasks/local-storage.yml b/ansible/roles/apps/tasks/local-storage.yml deleted file mode 100644 index 22e9c1325..000000000 --- a/ansible/roles/apps/tasks/local-storage.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: Create Kubernetes secret with local-storage settings - tags: - - config - - flux - - local-storage - vars: - flux: - name: "local-storage-settings" - namespace: "oas" - include_tasks: - file: flux_secret.yml - apply: - tags: - - config - - flux - - local-storage diff --git a/ansible/roles/apps/tasks/main.yml b/ansible/roles/apps/tasks/main.yml index 8e43e01e1..814454ecc 100644 --- a/ansible/roles/apps/tasks/main.yml +++ b/ansible/roles/apps/tasks/main.yml @@ -1,11 +1,8 @@ --- -- name: Install flux +- name: Install helm operator, local-storage and flux import_tasks: flux.yml -- name: Perform tasks necessary for local-storage - import_tasks: local-storage.yml - - name: Tasks pertaining to cert-manager import_tasks: cert-manager.yml -- GitLab