From 1e8734d4d77ce6ea106880660aca01715183d285 Mon Sep 17 00:00:00 2001 From: Kenneth Joss Date: Fri, 8 Sep 2023 09:04:10 +0200 Subject: [PATCH] Use group_var for primary/secondary instances instad of inventory group name --- ansible/roles/netbox/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/roles/netbox/tasks/main.yml b/ansible/roles/netbox/tasks/main.yml index 5785959fe2..dae0b3a85f 100644 --- a/ansible/roles/netbox/tasks/main.yml +++ b/ansible/roles/netbox/tasks/main.yml @@ -214,7 +214,7 @@ become: True become_user: '{{ netbox__user }}' when: (netbox__register_checkout is changed and - "netbox-master" in groups) + netbox__primary|bool) register: netbox__register_migration - name: Create Django superuser account @@ -226,7 +226,7 @@ virtualenv: '{{ netbox__virtualenv }}' become: True become_user: '{{ netbox__user }}' - when: ("netbox-master" in groups and + when: (netbox__primary|bool and not netbox__register_installed.stat.exists|bool and not netbox__register_migration.stdout is search('No migrations to apply.')) no_log: '{{ debops__no_log | d(True) }}'