From b28004bf357d461b09b4d993971233e8417d1664 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Mon, 12 Jul 2021 19:18:07 +0200 Subject: [PATCH] netbox: run upgrade script --- roles/netbox/tasks/main.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/roles/netbox/tasks/main.yml b/roles/netbox/tasks/main.yml index fa327f0..a9b3a99 100644 --- a/roles/netbox/tasks/main.yml +++ b/roles/netbox/tasks/main.yml @@ -54,6 +54,7 @@ dest: /opt remote_src: yes creates: '/opt/netbox-{{ netbox_version }}' + register: netbox_unarchive - name: Configure netbox template: @@ -69,12 +70,6 @@ owner: '{{ netbox_user }}' group: '{{ netbox_group }}' -- name: Install venv - pip: - requirements: '/opt/netbox-{{ netbox_version }}/requirements.txt' - virtualenv: '/opt/netbox-{{ netbox_version }}/venv' - virtualenv_command: '/usr/bin/python3 -m venv' - - name: Netbox file permissions file: path: '/opt/netbox-{{ netbox_version }}' @@ -82,10 +77,17 @@ group: '{{ netbox_group }}' recurse: yes +- name: Run upgrade script + command: + cmd: ./upgrade.sh + chdir: '/opt/netbox-{{ netbox_version }}' + become: true + become_user: '{{ netbox_user }}' + when: netbox_unarchive.changed + # TODO - still manual work -# * Run Database Migrations -# * Create a Super User -# * Collect Static Files +# * Create a super user +# * Migrate media files - name: Ensure certificates are available command: @@ -96,9 +98,9 @@ creates: '/etc/nginx/ssl/{{ netbox_domain }}.crt' notify: Restart nginx -#- name: Configure certificate manager for netbox -# template: src=certs.j2 dest=/etc/acertmgr/{{ netbox_domain }}.conf -# notify: Run acertmgr +- name: Configure certificate manager for netbox + template: src=certs.j2 dest=/etc/acertmgr/{{ netbox_domain }}.conf + notify: Run acertmgr - name: Configure vhost template: