Files
media-server/media-buildout.yml
zware 5046c5372d Rearrange task and add note to README
nfs was trying to mount before nfs-common was installed
added visudo info in readme, need to add base image
2022-08-24 21:51:26 -05:00

79 lines
1.9 KiB
YAML

- hosts: all
become: true
vars:
pip_install_packages:
- name: Docker
nfs_host: 192.168.0.109
nfs_options: "auto,nofail,noatime,nolock,intr,tcp,actimeo=1800"
nfs_mounts:
- remote_path: /export/Movies
local_path: /mnt/storage/movies
- remote_path: /export/TVShows
local_path: /mnt/storage/tv
- remote_path: /export/Scripts
local_path: /mnt/scripts
roles:
- geerlingguy.pip
- geerlingguy.docker
tasks:
- name: Install docker tools
ansible.builtin.package:
name: "{{ item }}"
state: present
loop:
- curl
- git
- tree
- vim
- docker-ce
- docker-ce-cli
- docker-compose
- nfs-common
- name: Mount NFS Volumes
ansible.posix.mount:
src: "{{ nfs_host }}:{{ item.remote_path }}"
path: "{{ item.local_path }}"
fstype: nfs
opts: "{{ nfs_options }}"
boot: true
state: mounted
loop: "{{ nfs_mounts | flatten }}"
- name: Update and upgrade apt packages
ansible.builtin.apt:
upgrade: true
update_cache: true
cache_valid_time: 86400
- name: Create Dockeruser and Add to Docker Group
ansible.builtin.user:
name: "{{ item.user }}"
shell: "{{ item.shell }}"
groups: "{{ item.groups }}"
loop:
- { user: "zware", shell: "/bin/zsh", groups: "sudo,docker" }
- { user: "dockeruser", shell: "/bin/bash", groups: "docker" }
- name: Copy docker-compose
ansible.builtin.copy:
src: docker-compose.yml
dest: /opt/docker-compose.yml
owner: root
group: root
mode: "0644"
- name: Copy env file
ansible.builtin.copy:
src: environment
dest: /etc/environment
owner: zware
group: zware
mode: "0600"
- name: Start containers
community.docker.docker_compose:
project_src: /opt/