feat: deployable playbook

This commit is contained in:
Doni Crosby 2025-09-27 13:36:00 -04:00
parent f8e1de4f0a
commit 7ab2b719dc
23 changed files with 754 additions and 176 deletions

View file

@ -15,7 +15,7 @@
- backup
- name: Backup PostgreSQL database
docker_compose:
community.docker.docker_compose_v2:
project_src: "{{ netbox_install_dir }}"
command: "db pg_dump -U {{ netbox_db_user }} {{ netbox_db_name }}"
register: db_backup

View file

@ -5,6 +5,9 @@
gather_facts: yes
pre_tasks:
- name: Include vault variables
include_vars: ../inventory/group_vars/netbox_servers_vault
- name: Verify Ubuntu distribution
fail:
msg: "This playbook only supports Ubuntu distributions"
@ -33,6 +36,12 @@
- docker
- containers
- role: traefik
tags:
- traefik-deploy
- traefik
- reverse-proxy
- role: netbox-deploy
tags:
- netbox-deploy
@ -44,13 +53,15 @@
debug:
msg:
- "NetBox deployment completed successfully!"
- "Access NetBox at: http://{{ ansible_default_ipv4.address }}:8000"
- "Access NetBox at: https://{{ netbox_domain }}"
- "Traefik Dashboard at: https://{{ traefik_domain }}:{{ traefik_dashboard_port }}"
- "Default admin credentials:"
- " Username: {{ netbox_superuser_name }}"
- " Email: {{ netbox_superuser_email }}"
- " Password: {{ netbox_superuser_password }}"
- "Installation directory: {{ netbox_install_dir }}"
- "Data directory: {{ netbox_data_dir }}"
- "Traefik installation directory: {{ traefik_install_dir }}"
tags: always
- name: Show Docker Compose status

View file

@ -16,14 +16,14 @@
- update-repo
- name: Pull latest Docker images
docker_compose:
community.docker.docker_compose_v2:
project_src: "{{ netbox_install_dir }}"
pull: yes
tags:
- pull-images
- name: Restart NetBox services
docker_compose:
community.docker.docker_compose_v2:
project_src: "{{ netbox_install_dir }}"
state: present
recreate: yes
@ -32,9 +32,10 @@
- name: Wait for NetBox to be ready
uri:
url: "http://localhost:8000/"
url: "https://{{ netbox_domain }}/"
method: GET
status_code: 200
validate_certs: false
register: netbox_ready
until: netbox_ready.status == 200
retries: 30