Skip to content
Snippets Groups Projects
Select Git revision
  • b8c20c86b51b92b83883d8447591a2980fa2cb63
  • master default protected
  • th/caddy-wip
  • th/caddy
  • th/lego
  • th/acmebot
  • pyzabbix
  • th/keycloak
8 results

netbox.yml

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    netbox.yml 1.72 KiB
    ---
    
    - name: Install LDAP auth configuration
      template:
        src: apps/netbox-ldap.py.j2
        dest: "{{app_path}}/netbox/netbox/ldap_config.py"
        owner: root
        group: "{{app_group}}"
        mode: '0640'
      notify:
        - "restart uwsgi instance {{ app.instance }}"
    
    # https://github.com/ansible/ansible/issues/42983
    - name: ensure there exists a .ansible folder
      file:
        path: "{{app_path}}/.ansible"
        state: directory
        owner: "{{app_user}}"
        group: "{{app_group}}"
    
    - name: ensure plugins are installed  # noqa 403
      pip:
        name:
          - napalm
          - django-auth-ldap
        virtualenv: "{{ app_venv }}"
        virtualenv_python: "python{{ app_python_version }}"
        state: latest
      notify:
        - "restart uwsgi instance {{ app.instance }}"
    
    - name: ensure data model migrations are applied  # noqa 301
      command: "{{app_venv}}/bin/python manage.py migrate"
      args:
        chdir: "{{app_chdir}}"
      become: true
      become_user: "{{app_user}}"
      notify:
        - "restart uwsgi instance {{app.instance}}"
    
    - name: Collect static files  # noqa 301
      command: "{{app_venv}}/bin/python manage.py collectstatic --no-input"
      args:
        chdir: "{{app_chdir}}"
    
    - name: ensure the folder from above is not present anymore
      file:
        path: "{{app_path}}/.ansible"
        state: absent
    
    - name: ensure the rqworker unit file exists
      template:
        src: apps/netbox-rqworker.service.j2
        dest: "/etc/systemd/system/{{ app_name }}-rqworker.service"
        owner: root
        group: root
        mode: '0644'
      notify:
        - reload systemd service files
        - "restart uwsgi instance {{app.instance}}"
    
    # Not needed (and working) at the moment
    # - name: ensure the rqworker service is enabled
    #   service:
    #     name: "{{app_name}}-rqworker"
    #     enabled: true
    #     state: started