mirror of
https://github.com/davestephens/ansible-nas
synced 2024-12-25 11:03:07 +00:00
Add Vagrantfile and testing script
This commit is contained in:
parent
4d5213756b
commit
a7081691f9
5 changed files with 68 additions and 297 deletions
|
@ -14,6 +14,6 @@ install:
|
||||||
- pip install ansible-lint
|
- pip install ansible-lint
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cp ${PWD}/tests/all.yml.test ${PWD}/group_vars/test.yml
|
- cp ${PWD}/tests/test.yml ${PWD}/group_vars/all.yml
|
||||||
- ansible-lint ${PWD}/nas.yml
|
- ansible-lint ${PWD}/nas.yml
|
||||||
- ${PWD}/tests/test.sh
|
- ${PWD}/tests/test.sh
|
|
@ -102,8 +102,9 @@ Getting help is easy! You can:
|
||||||
|
|
||||||
Contributions are welcome, please feel free to raise a PR!
|
Contributions are welcome, please feel free to raise a PR!
|
||||||
|
|
||||||
- Please restrict pull requests to one piece of functionality or bugfix at a time.
|
- Restrict pull requests to one piece of functionality or bugfix at a time.
|
||||||
- Please run `ansible-lint` against the playbook before committing. (There is a VSCode task set up to run the right command for you)
|
- Test your new functionality or bugfix using the included `tests/test-vagrant.sh` script to spin up a test VM.
|
||||||
|
- Run `ansible-lint` against the playbook before committing. (There is a VSCode task set up to run the right command for you)
|
||||||
- Please know that your efforts are appreciated, thanks! :+1:
|
- Please know that your efforts are appreciated, thanks! :+1:
|
||||||
|
|
||||||
Development of Ansible-NAS is carried out in [Visual Studio Code](https://code.visualstudio.com/) - you'll get some nice
|
Development of Ansible-NAS is carried out in [Visual Studio Code](https://code.visualstudio.com/) - you'll get some nice
|
||||||
|
|
18
Vagrantfile
vendored
Normal file
18
Vagrantfile
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
Vagrant.require_version ">= 1.7.0"
|
||||||
|
|
||||||
|
Vagrant.configure(2) do |config|
|
||||||
|
config.vm.box = "ubuntu/bionic64"
|
||||||
|
|
||||||
|
config.ssh.insert_key = false
|
||||||
|
config.vm.network "private_network", ip: "172.30.1.5"
|
||||||
|
|
||||||
|
|
||||||
|
config.vm.provision "ansible_local" do |ansible|
|
||||||
|
ansible.galaxy_role_file = "requirements.yml"
|
||||||
|
ansible.playbook = "nas.yml"
|
||||||
|
ansible.become = true
|
||||||
|
ansible.raw_arguments = [
|
||||||
|
"--extra-vars @tests/test.yml"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,294 +0,0 @@
|
||||||
###
|
|
||||||
### Ansible NAS Features
|
|
||||||
###
|
|
||||||
# Set these options to true or false to toggle specific features
|
|
||||||
|
|
||||||
# External Access
|
|
||||||
# Traefik will allow access to certain applications externally. To enable this you'll need a domain name that points to your
|
|
||||||
# home static IP address, or use a dynamic DNS provider like no-ip. You'll also need to map ports 80 and 443 from your router
|
|
||||||
# to your ansible-nas server.
|
|
||||||
traefik_enabled: true
|
|
||||||
|
|
||||||
# BitTorrent
|
|
||||||
# If you plan to use Transmission with OpenVPN, you'll need to copy group_vars/vpn_credentials.yml.dist
|
|
||||||
# to group_vars/vpn_credentials.yml, then update it with your own settings.
|
|
||||||
transmission_with_openvpn_enabled: false
|
|
||||||
transmission_enabled: false
|
|
||||||
|
|
||||||
# Plex
|
|
||||||
plex_enabled: false
|
|
||||||
tautulli_enabled: false
|
|
||||||
|
|
||||||
# Emby
|
|
||||||
emby_enabled: false
|
|
||||||
|
|
||||||
# Media Sourcing
|
|
||||||
sonarr_enabled: false
|
|
||||||
sickrage_enabled: false
|
|
||||||
couchpotato_enabled: false
|
|
||||||
radarr_enabled: false
|
|
||||||
|
|
||||||
# System Management
|
|
||||||
portainer_enabled: true
|
|
||||||
glances_enabled: true
|
|
||||||
stats_enabled: false
|
|
||||||
guacamole_enabled: false
|
|
||||||
|
|
||||||
# Backup & Restore
|
|
||||||
duplicati_enabled: true
|
|
||||||
nextcloud_enabled: false
|
|
||||||
gitea_enabled: false
|
|
||||||
|
|
||||||
# IRC bouncer
|
|
||||||
znc_enabled: false
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### General
|
|
||||||
###
|
|
||||||
# Sets the hostname of your Ansible NAS
|
|
||||||
ansible_nas_hostname: ansible-nas-test
|
|
||||||
|
|
||||||
# Sets the timezone for your Ansible NAS
|
|
||||||
# You can find a list here https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
||||||
ansible_nas_timezone: Etc/UTC
|
|
||||||
|
|
||||||
# Update all apt packages when playbook is run
|
|
||||||
keep_packages_updated: false
|
|
||||||
|
|
||||||
# Will be added to the docker group to give user command line access to docker
|
|
||||||
ansible_nas_user: david
|
|
||||||
|
|
||||||
# Your email and domain, used for LetsEncrypt SSL certs
|
|
||||||
ansible_nas_email: me@example.com
|
|
||||||
|
|
||||||
# Applications will have subdomain SSL certificates created, eg ansible-nas.<your-domain>, nextcloud.<your-domain>
|
|
||||||
ansible_nas_domain: example.com
|
|
||||||
|
|
||||||
###
|
|
||||||
### Docker
|
|
||||||
###
|
|
||||||
# Where you want Docker to store its images and container data.
|
|
||||||
docker_home: /mnt/Volume2/docker
|
|
||||||
|
|
||||||
# Docker storage driver, see https://docs.docker.com/storage/storagedriver/select-storage-driver/#supported-backing-filesystems
|
|
||||||
# You'll need to change this if your docker_home isn't on zfs and Docker won't start (you'll probably want overlay2 instead)
|
|
||||||
docker_storage_driver: overlay2
|
|
||||||
|
|
||||||
###
|
|
||||||
### Samba
|
|
||||||
###
|
|
||||||
# The location where all shares will be created by default. Can be overridden on a per-share basis.
|
|
||||||
# This path will be mounted to backup containers, Duplicati
|
|
||||||
samba_shares_root: /mnt/Volume3
|
|
||||||
|
|
||||||
# Where stuff downloaded will be stored
|
|
||||||
downloads_root: "{{ samba_shares_root }}/downloads"
|
|
||||||
|
|
||||||
# Where your movies are stored
|
|
||||||
movies_root: "{{ samba_shares_root }}/movies"
|
|
||||||
|
|
||||||
# Where your TV episodes are stored
|
|
||||||
tv_root: "{{ samba_shares_root }}/tv"
|
|
||||||
|
|
||||||
# Where torrent files are stored (picked up by Transmission for downloading)
|
|
||||||
torrents_root: "{{ samba_shares_root }}/torrents"
|
|
||||||
|
|
||||||
# The account used when Samba shares are accessed. Shouldn't need to change this unless you want to
|
|
||||||
# mess with Samba user permissions.
|
|
||||||
samba_guest_account: nobody
|
|
||||||
|
|
||||||
# Shares you want published over Samba.
|
|
||||||
samba_shares:
|
|
||||||
- name: downloads
|
|
||||||
comment: 'Stuff downloaded'
|
|
||||||
guest_ok: yes
|
|
||||||
public: yes
|
|
||||||
writable: yes
|
|
||||||
path: "{{ downloads_root }}"
|
|
||||||
|
|
||||||
- name: movies
|
|
||||||
comment: 'Movies'
|
|
||||||
guest_ok: yes
|
|
||||||
public: yes
|
|
||||||
writable: yes
|
|
||||||
path: "{{ movies_root }}"
|
|
||||||
|
|
||||||
- name: tv
|
|
||||||
comment: 'TV Episodes'
|
|
||||||
guest_ok: yes
|
|
||||||
public: yes
|
|
||||||
writable: yes
|
|
||||||
path: "{{ tv_root }}"
|
|
||||||
|
|
||||||
- name: dump
|
|
||||||
comment: 'File dump'
|
|
||||||
guest_ok: yes
|
|
||||||
public: yes
|
|
||||||
writable: yes
|
|
||||||
path: "{{ samba_shares_root }}/dump"
|
|
||||||
|
|
||||||
- name: games
|
|
||||||
comment: 'Games'
|
|
||||||
guest_ok: yes
|
|
||||||
public: yes
|
|
||||||
writable: yes
|
|
||||||
path: "{{ samba_shares_root }}/games"
|
|
||||||
|
|
||||||
- name: photos
|
|
||||||
comment: 'Pictures'
|
|
||||||
guest_ok: yes
|
|
||||||
public: yes
|
|
||||||
writable: yes
|
|
||||||
path: "{{ samba_shares_root }}/photos"
|
|
||||||
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
###### You shouldn't need to edit anything below this point ######
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
###
|
|
||||||
### Traefik
|
|
||||||
###
|
|
||||||
traefik_docker_image: traefik:1.7
|
|
||||||
traefik_data_directory: "{{ docker_home }}/traefik"
|
|
||||||
|
|
||||||
###
|
|
||||||
### Heimdall
|
|
||||||
###
|
|
||||||
heimdall_docker_image: linuxserver/heimdall:latest
|
|
||||||
heimdall_data_directory: "{{ docker_home }}/heimdall"
|
|
||||||
|
|
||||||
###
|
|
||||||
### Transmission
|
|
||||||
###
|
|
||||||
transmission_config_directory: "{{ docker_home }}/transmission/config"
|
|
||||||
transmission_download_directory: "{{ downloads_root }}"
|
|
||||||
transmission_watch_directory: "{{ torrents_root }}"
|
|
||||||
transmission_user_id: 0
|
|
||||||
transmission_group_id: 0
|
|
||||||
transmission_local_network: "192.168.1.0/24"
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### Plex
|
|
||||||
###
|
|
||||||
plex_config_directory: "{{ docker_home }}/plex/config"
|
|
||||||
plex_movies_directory: "{{ movies_root }}"
|
|
||||||
plex_tv_directory: "{{ tv_root }}"
|
|
||||||
plex_user_id: 0
|
|
||||||
plex_group_id: 0
|
|
||||||
|
|
||||||
###
|
|
||||||
### Emby
|
|
||||||
###
|
|
||||||
emby_config_directory: "{{ docker_home }}/emby/config"
|
|
||||||
emby_movies_directory: "{{ movies_root }}"
|
|
||||||
emby_tv_directory: "{{ tv_root }}"
|
|
||||||
emby_user_id: 0
|
|
||||||
emby_group_id: 0
|
|
||||||
|
|
||||||
###
|
|
||||||
### Tautulli
|
|
||||||
###
|
|
||||||
tautulli_config_directory: "{{ docker_home }}/tautulli/config"
|
|
||||||
tautulli_user_id: 0
|
|
||||||
tautulli_group_id: 0
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### Duplicati
|
|
||||||
###
|
|
||||||
duplicati_data_directory: "{{ docker_home }}/duplicati/config"
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### Sonarr
|
|
||||||
###
|
|
||||||
sonarr_data_directory: "{{ docker_home }}/sonarr/config"
|
|
||||||
sonarr_tv_directory: "{{ tv_root }}"
|
|
||||||
sonarr_download_directory: "{{ downloads_root }}"
|
|
||||||
sonarr_user_id: 0
|
|
||||||
sonarr_group_id: 0
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### Radarr
|
|
||||||
###
|
|
||||||
radarr_movies_directory: "{{ movies_root }}"
|
|
||||||
radarr_download_directory: "{{ downloads_root }}"
|
|
||||||
radarr_data_directory: "{{ docker_home }}/radarr"
|
|
||||||
radarr_user_id: 0
|
|
||||||
radarr_group_id: 0
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### Couchpotato
|
|
||||||
###
|
|
||||||
couchpotato_config_directory: "{{ docker_home }}/couchpotato/config"
|
|
||||||
couchpotato_movies_directory: "{{ movies_root }}"
|
|
||||||
couchpotato_downloads_directory: "{{ downloads_root }}"
|
|
||||||
couchpotato_torrents_directory: "{{ torrents_root }}"
|
|
||||||
couchpotato_user_id: 0
|
|
||||||
couchpotato_group_id: 0
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### Sickrage
|
|
||||||
###
|
|
||||||
sickrage_config_directory: "{{ docker_home }}/sickrage/config"
|
|
||||||
sickrage_tv_directory: "{{ tv_root }}"
|
|
||||||
sickrage_downloads_directory: "{{ downloads_root }}"
|
|
||||||
sickrage_user_id: 0
|
|
||||||
sickrage_group_id: 0
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### OpenVPN
|
|
||||||
###
|
|
||||||
openvpn_config_directory: "{{ docker_home }}/openvpn"
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### Portainer
|
|
||||||
###
|
|
||||||
portainer_data_directory: "{{ docker_home }}/portainer/config"
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### ZNC
|
|
||||||
###
|
|
||||||
znc_data_directory: "{{ docker_home }}/znc"
|
|
||||||
znc_user_id: 0
|
|
||||||
znc_group_id: 0
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
### Stats
|
|
||||||
###
|
|
||||||
telegraf_data_directory: "{{ docker_home }}/telegraf"
|
|
||||||
influxdb_data_directory: "{{ docker_home }}/influxdb"
|
|
||||||
grafana_data_directory: "{{ docker_home }}/grafana"
|
|
||||||
stat_collection_interval: 15s
|
|
||||||
|
|
||||||
###
|
|
||||||
### Gitea
|
|
||||||
###
|
|
||||||
gitea_data_directory: "{{ docker_home }}/gitea"
|
|
||||||
|
|
||||||
###
|
|
||||||
### Nextcloud
|
|
||||||
###
|
|
||||||
nextcloud_data_directory: "{{ docker_home }}/nextcloud"
|
|
||||||
|
|
||||||
###
|
|
||||||
### nginx
|
|
||||||
###
|
|
||||||
nginx_data_directory: "{{ docker_home }}/nginx"
|
|
||||||
|
|
||||||
###
|
|
||||||
### Guacamole
|
|
||||||
###
|
|
||||||
guacamole_docker_image: guacamole/guacamole:0.9.14
|
|
||||||
guacamole_guacd_docker_image: guacamole/guacd:0.9.14
|
|
||||||
guacamole_data_directory: "{{ docker_home }}/guacamole"
|
|
46
tests/test-vagrant.sh
Executable file
46
tests/test-vagrant.sh
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
DIR=$(dirname "$0")
|
||||||
|
PLAYBOOK_DIR=$DIR/..
|
||||||
|
|
||||||
|
header() {
|
||||||
|
clear
|
||||||
|
cat << EndOfMessage
|
||||||
|
▄▄▄ ███▄ █ ██████ ██▓ ▄▄▄▄ ██▓ ▓█████ ███▄ █ ▄▄▄ ██████
|
||||||
|
▒████▄ ██ ▀█ █ ▒██ ▒ ▓██▒▓█████▄ ▓██▒ ▓█ ▀ ██ ▀█ █ ▒████▄ ▒██ ▒
|
||||||
|
▒██ ▀█▄ ▓██ ▀█ ██▒░ ▓██▄ ▒██▒▒██▒ ▄██▒██░ ▒███ ▓██ ▀█ ██▒▒██ ▀█▄ ░ ▓██▄
|
||||||
|
░██▄▄▄▄██ ▓██▒ ▐▌██▒ ▒ ██▒░██░▒██░█▀ ▒██░ ▒▓█ ▄ ▓██▒ ▐▌██▒░██▄▄▄▄██ ▒ ██▒
|
||||||
|
▓█ ▓██▒▒██░ ▓██░▒██████▒▒░██░░▓█ ▀█▓░██████▒░▒████▒ ▒██░ ▓██░ ▓█ ▓██▒▒██████▒▒
|
||||||
|
▒▒ ▓▒█░░ ▒░ ▒ ▒ ▒ ▒▓▒ ▒ ░░▓ ░▒▓███▀▒░ ▒░▓ ░░░ ▒░ ░ ░ ▒░ ▒ ▒ ▒▒ ▓▒█░▒ ▒▓▒ ▒ ░
|
||||||
|
▒ ▒▒ ░░ ░░ ░ ▒░░ ░▒ ░ ░ ▒ ░▒░▒ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░░ ░ ▒░ ▒ ▒▒ ░░ ░▒ ░ ░
|
||||||
|
░ ▒ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░
|
||||||
|
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
|
||||||
|
░
|
||||||
|
EndOfMessage
|
||||||
|
sleep 5
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
printf "${TIME_FORMAT} %b\n" "$*";
|
||||||
|
}
|
||||||
|
|
||||||
|
fatal_error() {
|
||||||
|
printf "${TIME_FORMAT} \e[41mERROR:\033[0m %b\n" "$*" >&2;
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
test_needs() {
|
||||||
|
command -v $1 >/dev/null 2>&1 || fatal_error "Testing Ansible-NAS requires $1 but it's not installed. Please install it and try again."
|
||||||
|
}
|
||||||
|
|
||||||
|
testing_init() {
|
||||||
|
log "Checking Vagrant installation"
|
||||||
|
test_needs vagrant
|
||||||
|
}
|
||||||
|
|
||||||
|
header
|
||||||
|
testing_init
|
||||||
|
|
||||||
|
log "Starting Vagrant and running playbook"
|
||||||
|
vagrant up
|
||||||
|
|
||||||
|
log "Vagrant up completed, you can connect to the VM at http://172.30.1.5:10080. When you've finished testing, run 'vagrant destroy' to kill the VM."
|
Loading…
Reference in a new issue