Initial Commit of initial state
At least better then the usual "initial commit!"-Commit!
commit
a776e79006
@ -0,0 +1,75 @@
|
||||
---
|
||||
netbox:
|
||||
conf:
|
||||
metrics: "false"
|
||||
secretkey: "r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj"
|
||||
|
||||
mail:
|
||||
from: "netbox@bar.com"
|
||||
password: ""
|
||||
port: "25"
|
||||
host: "localhost"
|
||||
user: "netbox"
|
||||
tls: "false"
|
||||
timeout: 10 # seconds
|
||||
ssl:
|
||||
enabled: "false"
|
||||
certfile: ""
|
||||
keyfile: ""
|
||||
|
||||
user:
|
||||
superuser:
|
||||
name: "admin"
|
||||
api_token: "0123456789abcdef0123456789abcdef01234567"
|
||||
mail: "admin@example.com"
|
||||
password: "admin"
|
||||
|
||||
hostnames:
|
||||
main: "netbox"
|
||||
worker: "netbox-worker"
|
||||
housekeeper: "netbox-housekeeper"
|
||||
|
||||
napalm:
|
||||
user: ""
|
||||
password: ""
|
||||
timeout: 10
|
||||
|
||||
base_dir: "/srv/netbox"
|
||||
media_root: "/opt/netbox/netbox/media"
|
||||
|
||||
|
||||
volumes:
|
||||
main:
|
||||
startup_scripts: "startup_scripts"
|
||||
initializers: "initializers"
|
||||
configuration: "configuration"
|
||||
reports: "reports"
|
||||
scripts: "scripts"
|
||||
media_files: "netbox-media-files"
|
||||
data:
|
||||
postgres: "netbox-postgres-data"
|
||||
redis: "netbox-redis-data"
|
||||
|
||||
|
||||
envs:
|
||||
netbox: "env/netbox.env"
|
||||
postgres: "env/postgres.env"
|
||||
redis: "env/redis.env"
|
||||
redis_cache: "env/redis-cache.env"
|
||||
|
||||
|
||||
services:
|
||||
redis:
|
||||
main:
|
||||
password: "H733Kdjndks82"
|
||||
hostname: "redis"
|
||||
|
||||
cache:
|
||||
password: "T4Ph722qJ5QHeQ1qfu36"
|
||||
hostname: "redis-cache"
|
||||
|
||||
postgres:
|
||||
db: "netbox"
|
||||
user: "netbox"
|
||||
password: "J5brHrAXFLQSif0K"
|
||||
hostname: "postgres"
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- name: install required packages
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- docker
|
||||
- docker-compose
|
||||
state: present
|
||||
|
||||
- name: restart netbox
|
||||
docker_compose:
|
||||
project_src: "{{ netbox.conf.base_dir }}"
|
||||
restarted: true
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
|
||||
|
||||
- name: create netbox directory
|
||||
file:
|
||||
path: "{{ netbox.conf.base_dir }}/env"
|
||||
state: directory
|
||||
recurse: true
|
||||
notify: install required packages
|
||||
|
||||
- name: update environment files
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ netbox.conf.base_dir }}/{{ item }}"
|
||||
loop:
|
||||
- env/netbox.env
|
||||
- env/postgres.env
|
||||
- env/redis.env
|
||||
- env/redis-cache.env
|
||||
- docker-compose.yml
|
||||
- docker-compose.override.yml
|
||||
notify: restart netbox
|
@ -0,0 +1,5 @@
|
||||
version: '3.4'
|
||||
services:
|
||||
netbox:
|
||||
ports:
|
||||
- "8080:8080"
|
@ -0,0 +1,77 @@
|
||||
version: '3.4'
|
||||
services:
|
||||
netbox: &netbox
|
||||
image: netboxcommunity/netbox:${VERSION-v3.1-1.5.1}
|
||||
hostname: {{ netbox.conf.hostnames.main }}
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
- redis-cache
|
||||
- netbox-worker
|
||||
env_file: {{ netbox.envs.netbox }}
|
||||
user: 'unit:root'
|
||||
volumes:
|
||||
- {{ netbox.volumes.main.startup_scripts }}:/opt/netbox/startup_scripts:z,ro
|
||||
- {{ netbox.volumes.main.initializers }}:/opt/netbox/initializers:z,ro
|
||||
- {{ netbox.volumes.main.configuration }}:/etc/netbox/config:z,ro
|
||||
- {{ netbox.volumes.main.reports }}:/etc/netbox/reports:z,ro
|
||||
- {{ netbox.volumes.main.scripts }}:/etc/netbox/scripts:z,ro
|
||||
- {{ netbox.volumes.main.media_files }}:/opt/netbox/netbox/media:z
|
||||
netbox-worker:
|
||||
<<: *netbox
|
||||
hostname: {{ netbox.conf.hostnames.worker }}
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
command:
|
||||
- /opt/netbox/venv/bin/python
|
||||
- /opt/netbox/netbox/manage.py
|
||||
- rqworker
|
||||
netbox-housekeeping:
|
||||
<<: *netbox
|
||||
hostname: {{ netbox.conf.hostnames.housekeeper }}
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
command:
|
||||
- /opt/netbox/housekeeping.sh
|
||||
|
||||
# postgres
|
||||
postgres:
|
||||
image: postgres:14-alpine
|
||||
hostname: {{ netbox.services.postgres.hostname }}
|
||||
env_file: {{ netbox.envs.postgres }}
|
||||
volumes:
|
||||
- {{ netbox.volumes.data.postgres }}:/var/lib/postgresql/data
|
||||
# {{ spam_login }}
|
||||
|
||||
# redis
|
||||
redis:
|
||||
image: redis:6-alpine
|
||||
hostname: {{ netbox.services.redis.main.hostname }}
|
||||
command:
|
||||
- sh
|
||||
- -c # this is to evaluate the $REDIS_PASSWORD from the env
|
||||
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
|
||||
env_file: {{ netbox.envs.redis }}
|
||||
volumes:
|
||||
- {{ netbox.volumes.data.redis }}:/data
|
||||
redis-cache:
|
||||
image: redis:6-alpine
|
||||
hostname: {{ netbox.services.redis.cache.hostname }}
|
||||
command:
|
||||
- sh
|
||||
- -c # this is to evaluate the $REDIS_PASSWORD from the env
|
||||
- redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
|
||||
env_file: {{ netbox.envs.redis_cache }}
|
||||
|
||||
volumes:
|
||||
{% for key, volume in netbox.volumes.main.items() -%}
|
||||
{{ volume }}:
|
||||
driver: local
|
||||
{% endfor -%}
|
||||
|
||||
{% for key, volume in netbox.volumes.data.items() -%}
|
||||
{{ volume }}:
|
||||
driver: local
|
||||
{% endfor %}
|
@ -0,0 +1,46 @@
|
||||
CORS_ORIGIN_ALLOW_ALL=True
|
||||
DB_HOST={{ netbox.services.postgres.hostname }}
|
||||
DB_NAME={{ netbox.services.postgres.db }}
|
||||
DB_PASSWORD={{ netbox.services.postgres.password }}
|
||||
DB_USER={{ netbox.services.postgres.user }}
|
||||
EMAIL_FROM={{ netbox.conf.mail.from }}
|
||||
EMAIL_PASSWORD={{ netbox.conf.mail.password }}
|
||||
EMAIL_PORT={{ netbox.conf.mail.port }}
|
||||
EMAIL_SERVER={{ netbox.conf.mail.host }}
|
||||
EMAIL_SSL_CERTFILE={{ netbox.conf.mail.ssl.certfile }}
|
||||
EMAIL_SSL_KEYFILE={{ netbox.conf.mail.ssl.keyfile }}
|
||||
EMAIL_TIMEOUT={{ netbox.conf.mail.timeout }}
|
||||
EMAIL_USERNAME={{ netbox.conf.mail.user }}
|
||||
# EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive, i.e. they can't both be `true`!
|
||||
EMAIL_USE_SSL={{ netbox.conf.mail.ssl.enabled }}
|
||||
EMAIL_USE_TLS={{ netbox.conf.mail.tls }}
|
||||
HOUSEKEEPING_INTERVAL=86400
|
||||
MAX_PAGE_SIZE=1000
|
||||
MEDIA_ROOT={{ netbox.conf.media_root }}
|
||||
METRICS_ENABLED={{ netbox.conf.metrics }}
|
||||
NAPALM_PASSWORD={{ netbox.conf.napalm.password }}
|
||||
NAPALM_TIMEOUT={{ netbox.conf.napalm.timeout }}
|
||||
NAPALM_USERNAME={{ netbox.conf.napalm.user }}
|
||||
REDIS_CACHE_DATABASE=1
|
||||
REDIS_CACHE_HOST={{ netbox.services.redis.cache.hostname }}
|
||||
REDIS_CACHE_INSECURE_SKIP_TLS_VERIFY=false
|
||||
REDIS_CACHE_PASSWORD={{ netbox.services.redis.cache.password }}
|
||||
REDIS_CACHE_SSL=false
|
||||
REDIS_DATABASE=0
|
||||
REDIS_HOST={{ netbox.services.redis.main.hostname }}
|
||||
REDIS_INSECURE_SKIP_TLS_VERIFY=false
|
||||
REDIS_PASSWORD={{ netbox.services.redis.main.password }}
|
||||
REDIS_SSL=false
|
||||
RELEASE_CHECK_URL=https://api.github.com/repos/netbox-community/netbox/releases
|
||||
SECRET_KEY={{ netbox.conf.secretkey }}
|
||||
SKIP_STARTUP_SCRIPTS=false
|
||||
SKIP_SUPERUSER=false
|
||||
SUPERUSER_API_TOKEN={{ netbox.conf.user.superuser.api_token }}
|
||||
SUPERUSER_EMAIL={{ netbox.conf.user.superuser.mail }}
|
||||
SUPERUSER_NAME={{ netbox.conf.user.superuser.name }}
|
||||
SUPERUSER_PASSWORD={{ netbox.conf.user.superuser.password }}
|
||||
WEBHOOKS_ENABLED=true
|
||||
|
||||
DEBUG=true
|
||||
INTERNAL_IPS=*
|
||||
ALLOWED_HOSTS=*
|
@ -0,0 +1,3 @@
|
||||
POSTGRES_DB={{ netbox.services.postgres.db }}
|
||||
POSTGRES_PASSWORD={{ netbox.services.postgres.password }}
|
||||
POSTGRES_USER={{ netbox.services.postgres.user }}
|
@ -0,0 +1 @@
|
||||
REDIS_PASSWORD={{ netbox.services.redis.cache.password }}
|
@ -0,0 +1 @@
|
||||
REDIS_PASSWORD={{ netbox.services.redis.main.password }}
|
Loading…
Reference in New Issue