├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── hosts.ini.example ├── playbook.yml └── roles ├── pihole └── tasks │ └── main.yml ├── python └── tasks │ └── main.yml ├── tautulli └── tasks │ └── main.yml ├── watchtower └── tasks │ └── main.yml └── youtube-dl-server └── tasks └── main.yml /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: guillaumebriday 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | hosts.ini 2 | playbook.retry 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Guillaume Briday 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ansible playbook for my Home Media Server 2 | 3 | This is an [Ansible](https://www.ansible.com) playbook to install and configure some apps on my Synology NAS with [Docker](https://www.docker.com). 4 | 5 | ## Requirements 6 | 7 | + Ansible >= 2.4.0. 8 | 9 | ## Applications 10 | 11 | This playbook is designed to install a bunch of useful apps : 12 | 13 | + [Tautulli](https://tautulli.com/) 14 | + [Watchtower](https://github.com/containrrr/watchtower/) 15 | + [Youtube-dl-server](https://github.com/manbearwiz/youtube-dl-server) 16 | + [Pi-hole](https://pi-hole.net/) 17 | 18 | ## Installing on production 19 | 20 | Copy the hosts example file and change the values to your needs : 21 | 22 | ```bash 23 | $ cp hosts.ini.example hosts.ini 24 | ``` 25 | 26 | Then run the playbook : 27 | 28 | ```bash 29 | $ ansible-playbook -i hosts.ini playbook.yml 30 | ``` 31 | 32 | If you want to run the playbook locally, set the address in the hosts file: 33 | ```ini 34 | [webservers] 35 | localhost ansible_connection=local 36 | ``` 37 | 38 | ## Contributing 39 | 40 | Do not hesitate to contribute to the project by adapting or adding features ! Bug reports or pull requests are welcome. 41 | 42 | ## License 43 | 44 | This project is released under the [MIT](http://opensource.org/licenses/MIT) license. 45 | -------------------------------------------------------------------------------- /hosts.ini.example: -------------------------------------------------------------------------------- 1 | [webservers] 2 | example.com 3 | 4 | [webservers:vars] 5 | ansible_python_interpreter=/usr/bin/python3 6 | 7 | WATCHTOWER_SCHEDULE="0 0 5 * * *" 8 | NOTIFICATION_SLACK_HOOK_URL=https://hooks.slack.com/services/xxx/yyyyyyyyyyyyyyy 9 | PIHOLE_PASSWORD= 10 | -------------------------------------------------------------------------------- /playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Provisionning webservers group 3 | hosts: webservers 4 | roles: 5 | - python 6 | - watchtower 7 | - tautulli 8 | - youtube-dl-server 9 | - pihole 10 | -------------------------------------------------------------------------------- /roles/pihole/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Ensures config directory exists 3 | file: 4 | path: "/volume1/docker/pihole/{{ item }}" 5 | state: directory 6 | loop: 7 | - etc-pihole 8 | - etc-dnsmasq.d 9 | 10 | - name: Create the Pi-Hole container 11 | docker_container: 12 | name: pihole 13 | image: pihole/pihole 14 | restart_policy: unless-stopped 15 | pull: true 16 | network_mode: host 17 | volumes: 18 | - /volume1/docker/pihole/etc-pihole:/etc/pihole/ 19 | - /volume1/docker/pihole/etc-dnsmasq.d:/etc/dnsmasq.d/ 20 | - /etc/localtime:/etc/localtime:ro 21 | env: 22 | TZ: "Europe/Paris" 23 | WEB_PORT: "8080" 24 | DNSMASQ_LISTENING: "local" 25 | ServerIP: "192.168.1.22" 26 | WEBPASSWORD: "{{ PIHOLE_PASSWORD }}" 27 | PIHOLE_DNS_: "80.67.169.12;80.67.169.40" 28 | -------------------------------------------------------------------------------- /roles/python/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install pip 3 | easy_install: 4 | name: pip 5 | state: latest 6 | 7 | - name: Add the Python client for Docker 8 | pip: 9 | name: docker-py 10 | -------------------------------------------------------------------------------- /roles/tautulli/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create the Tautulli container 3 | docker_container: 4 | name: tautulli 5 | image: linuxserver/tautulli 6 | restart_policy: unless-stopped 7 | pull: true 8 | ports: 9 | - "8181:8181" 10 | volumes: 11 | - /etc/localtime:/etc/localtime:ro 12 | - /volume1/docker/tautulli/config:/config 13 | - /volume1/Plex/Library/Application Support/Plex Media Server/Logs:/logs:ro 14 | -------------------------------------------------------------------------------- /roles/watchtower/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create the Watchtower container 3 | docker_container: 4 | name: watchtower 5 | image: containrrr/watchtower 6 | restart_policy: unless-stopped 7 | pull: true 8 | volumes: 9 | - /var/run/docker.sock:/var/run/docker.sock 10 | - /etc/localtime:/etc/localtime:ro 11 | env: 12 | WATCHTOWER_SCHEDULE: "{{ WATCHTOWER_SCHEDULE }}" 13 | WATCHTOWER_CLEANUP: "true" 14 | WATCHTOWER_NOTIFICATIONS: "slack" 15 | WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL: "{{ NOTIFICATION_SLACK_HOOK_URL }}" 16 | -------------------------------------------------------------------------------- /roles/youtube-dl-server/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create the youtube-dl-server container 3 | docker_container: 4 | name: youtube-dl-server 5 | image: kmb32123/youtube-dl-server 6 | restart_policy: unless-stopped 7 | pull: true 8 | ports: 9 | - "32000:8080" 10 | volumes: 11 | - /etc/localtime:/etc/localtime:ro 12 | - /volume1/Downloads/Youtube:/youtube-dl 13 | --------------------------------------------------------------------------------