--- - name: Deploy NetBox with Docker Compose hosts: netbox become: yes gather_facts: yes pre_tasks: - name: Verify Ubuntu distribution fail: msg: "This playbook only supports Ubuntu distributions" when: ansible_distribution != "Ubuntu" tags: always - name: Display deployment information debug: msg: - "Deploying NetBox to {{ inventory_hostname }}" - "OS: {{ ansible_distribution }} {{ ansible_distribution_version }}" - "Architecture: {{ ansible_architecture }}" - "Installation directory: {{ netbox_install_dir }}" tags: always roles: - role: system-update tags: - system-update - updates - packages - role: docker-install tags: - docker-install - docker - containers - role: netbox-deploy tags: - netbox-deploy - netbox - application post_tasks: - name: Display NetBox access information debug: msg: - "NetBox deployment completed successfully!" - "Access NetBox at: http://{{ ansible_default_ipv4.address }}:8000" - "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 }}" tags: always - name: Show Docker Compose status command: docker compose ps args: chdir: "{{ netbox_install_dir }}" register: docker_compose_status changed_when: false tags: always - name: Display Docker Compose status debug: var: docker_compose_status.stdout_lines tags: always