Skip to content

Commit

Permalink
fix: 🐛 Add first install check to prevent failures on upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
cmon33 authored and this-is-tobi committed Jan 9, 2025
1 parent db44dfd commit e1cc7b3
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion roles/nexus/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
---
- name: Check if first install
block:
- name: Initialize first_install fact
ansible.builtin.set_fact:
first_install: false

- name: Check Nexus Pod
kubernetes.core.k8s_info:
kind: Pod
namespace: "{{ dsc.nexus.namespace }}"
register: check_nx_pod

- name: Set first_install fact
when: check_nx_pod.resources | length == 0
ansible.builtin.set_fact:
first_install: true

- name: Create nexus Namespace
kubernetes.core.k8s:
definition:
Expand Down Expand Up @@ -41,6 +58,7 @@
delay: 5

- name: Retrieve initial admin password on first install
when: first_install
block:
- name: Get nexus pod's name
kubernetes.core.k8s_info:
Expand All @@ -62,7 +80,7 @@
ignore_errors: true

- name: Change Nexus password on first install
when: initial_admin_password.stdout | length > 0
when: first_install
block:
- name: Generate random password
ansible.builtin.set_fact:
Expand Down

0 comments on commit e1cc7b3

Please sign in to comment.