Move base ansible-nas configuration to roles

This commit is contained in:
David Stephens 2021-01-12 12:56:03 +00:00
parent 9884392a7f
commit 46fe985dd9
8 changed files with 53 additions and 46 deletions

View file

@ -117,15 +117,7 @@ traefik_port_ui: "8083"
###
### General
###
# Sets the hostname of your Ansible NAS
ansible_nas_hostname: ansible-nas
# 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
@ -136,19 +128,6 @@ ansible_nas_email: me@example.com
# Applications will have subdomain SSL certificates created if Traefik is enabled, e.g. ansible-nas.<your-domain>, nextcloud.<your-domain>
ansible_nas_domain: example.com
###
### Docker
###
# Where you want Docker to store images
docker_image_directory: "{{ docker_home }}/data"
# Where you want Docker to store its container data.
docker_home: /mnt/Volume2/docker
# Docker storage driver, see https://docs.docker.com/storage/storagedriver/select-storage-driver/#supported-backing-filesystems
# You might want to change this to ZFS, depending on your underlying filesystem.
docker_storage_driver: overlay2
###
### Samba
###
@ -301,15 +280,7 @@ cloudflare_api_key: abcdeabcdeabcdeabcde1234512345
###
### General
###
# Extra packages to install
ansible_nas_extra_packages:
- smartmontools
- htop
- zfsutils-linux
- bonnie++
- unzip
- lm-sensors
- ctop
ansible_python_interpreter: /usr/bin/python3

16
nas.yml
View file

@ -21,6 +21,16 @@
- docker
- skip_ansible_lint
- role: ansible-nas-general
tags:
- ansible-nas-general
- ansible-nas
- role: ansible-nas-docker
tags:
- ansible-nas-docker
- ansible-nas
- role: heimdall
tags:
- heimdall
@ -32,12 +42,6 @@
when: (plex_enabled | default(False))
tasks:
- import_tasks: tasks/general.yml
tags: general
- import_tasks: tasks/docker.yml
tags: docker
- import_tasks: tasks/portainer.yml
when: (portainer_enabled | default(False))
tags: portainer

View file

@ -0,0 +1,12 @@
---
ansible_nas_user: david
# Where you want Docker to store its container data.
docker_home: /mnt/Volume2/docker
# Where you want Docker to store images
docker_image_directory: "{{ docker_home }}/data"
# Docker storage driver, see https://docs.docker.com/storage/storagedriver/select-storage-driver/#supported-backing-filesystems
# You might want to change this to ZFS, depending on your underlying filesystem.
docker_storage_driver: overlay2

View file

@ -1,44 +1,44 @@
---
- name: install python3-pip
- name: Install python3-pip
apt:
name: python3-pip
state: present
register: result
until: result is succeeded
- name: 'Remove docker-py python module'
- name: Remove docker-py python module
pip:
name: docker-py
state: absent
register: result
until: result is succeeded
- name: 'Install docker python module'
- name: Install docker python module
pip:
name: docker
state: present
register: result
until: result is succeeded
- name: create docker home
- name: Create Docker home directory
file:
path: "{{ docker_home }}"
mode: 0755
state: directory
- name: add user account to docker group
- name: Add user account to Docker group
user:
name: "{{ ansible_nas_user }}"
groups: docker
append: yes
- name: update docker home from install default
- name: Update Docker home from install default
template:
src: docker/daemon.json
src: daemon.json
dest: /etc/docker/daemon.json
register: docker_config
- name: restart docker
- name: Restart Docker
service:
name: docker
state: restarted

View file

@ -0,0 +1,20 @@
---
# Sets the hostname of your Ansible NAS
ansible_nas_hostname: ansible-nas
# Update all apt packages when playbook is run
keep_packages_updated: false
# Extra packages to install
ansible_nas_extra_packages:
- smartmontools
- htop
- zfsutils-linux
- bonnie++
- unzip
- lm-sensors
- ctop
# 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

View file

@ -1,7 +1,7 @@
---
- name: Set login banner
template:
src: ansible-nas/motd.txt
copy:
src: motd.txt
dest: /etc/motd
- name: Enable Universe repository