migration for mediaserver to docker in testing. mounting the drive looks like its working now

This commit is contained in:
James Tombleson 2019-11-03 21:46:19 -08:00
parent c95f1099a0
commit 2aa633d884
22 changed files with 283 additions and 4565 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
# some basic default values...
inventory = ./inventory/
inventory = ./inventory/home.yaml
#library = /usr/share/my_modules/:./modules/
# Looks like modules can only be pointed to a single directory

View File

@ -1,32 +1,89 @@
---
all:
hosts:
all:
children:
linux:
192.160.0.60
vars:
ansible_user: !vault |
linux-all:
hosts:
192.168.0.60:
192.168.0.76:
vars:
ansible_user: !vault |
$ANSIBLE_VAULT;1.1;AES256
33393963653363383638373235363531386238626138366632336531663437373634333766656437
3462613266323931343431616465623439626534646238640a616461633434626631376266383234
61386535373738386632626331353665643137373234323566326633386234666534616330306639
3739633437353337380a373437643563663163653834653637363861663639363635333866613435
6636
ansible_password: !vault |
32323438633437386234366165646365303038656639396632313933396431376136343837393738
6131653037623836383032613766653233656338303566330a653938333062363432643365316133
61626164383063636362343362663133653964646139386635626365373564306238306566633930
3139363666373864620a656336653633376539616337303361333936313462623963643861646166
3364
ansible_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
62386164373234666130346666653866663136623261386364636632303430616135343132303631
3632316465666237613232313761353135316433376562360a633931646238326139336532373633
32666636326332346536366165373030346265626633646335303033636337333336323164636338
3036393466633634640a313262373661623731623639343565653061663830303537666136346165
3834
ansible_connection: ssh
ansible_become_method: sudo
ansible_become_pass: !vault |
63363131623134643365366432393962613032383931613663353233356334316536326334333739
3130663431363561373437353262313430623131363864350a393064636161613232633036303139
65643166363565343562663937343866623035356639333635636432333363653463666433303035
6134646432353330630a343839643163323733623265356261306661396332326465656561633734
6231
ansible_connection: ssh
ansible_become_method: sudo
ansible_become_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
62386164373234666130346666653866663136623261386364636632303430616135343132303631
3632316465666237613232313761353135316433376562360a633931646238326139336532373633
32666636326332346536366165373030346265626633646335303033636337333336323164636338
3036393466633634640a313262373661623731623639343565653061663830303537666136346165
3834
ansible_python_interpreter: /usr/bin/python3
63363131623134643365366432393962613032383931613663353233356334316536326334333739
3130663431363561373437353262313430623131363864350a393064636161613232633036303139
65643166363565343562663937343866623035356639333635636432333363653463666433303035
6134646432353330630a343839643163323733623265356261306661396332326465656561633734
6231
ansible_python_interpreter: /usr/bin/python3
docker:
hosts:
192.168.0.76:
vars:
ansible_user: !vault |
$ANSIBLE_VAULT;1.1;AES256
32323438633437386234366165646365303038656639396632313933396431376136343837393738
6131653037623836383032613766653233656338303566330a653938333062363432643365316133
61626164383063636362343362663133653964646139386635626365373564306238306566633930
3139363666373864620a656336653633376539616337303361333936313462623963643861646166
3364
ansible_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
63363131623134643365366432393962613032383931613663353233356334316536326334333739
3130663431363561373437353262313430623131363864350a393064636161613232633036303139
65643166363565343562663937343866623035356639333635636432333363653463666433303035
6134646432353330630a343839643163323733623265356261306661396332326465656561633734
6231
ansible_connection: ssh
ansible_become_method: sudo
ansible_become_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
63363131623134643365366432393962613032383931613663353233356334316536326334333739
3130663431363561373437353262313430623131363864350a393064636161613232633036303139
65643166363565343562663937343866623035356639333635636432333363653463666433303035
6134646432353330630a343839643163323733623265356261306661396332326465656561633734
6231
ansible_python_interpreter: /usr/bin/python3
mediaserver:
hosts:
192.168.0.76:
vars:
ansible_user: !vault |
$ANSIBLE_VAULT;1.1;AES256
32323438633437386234366165646365303038656639396632313933396431376136343837393738
6131653037623836383032613766653233656338303566330a653938333062363432643365316133
61626164383063636362343362663133653964646139386635626365373564306238306566633930
3139363666373864620a656336653633376539616337303361333936313462623963643861646166
3364
ansible_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
63363131623134643365366432393962613032383931613663353233356334316536326334333739
3130663431363561373437353262313430623131363864350a393064636161613232633036303139
65643166363565343562663937343866623035356639333635636432333363653463666433303035
6134646432353330630a343839643163323733623265356261306661396332326465656561633734
6231
ansible_connection: ssh
ansible_become_method: sudo
ansible_become_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
63363131623134643365366432393962613032383931613663353233356334316536326334333739
3130663431363561373437353262313430623131363864350a393064636161613232633036303139
65643166363565343562663937343866623035356639333635636432333363653463666433303035
6134646432353330630a343839643163323733623265356261306661396332326465656561633734
6231
ansible_python_interpreter: /usr/bin/python3

View File

@ -1,24 +1,23 @@
---
# https://github.com/linuxserver/docker-hydra2
- name: Media Server
hosts: localhost
become: yes
hosts: linux
vars_files:
- vars.yml
tasks:
- name: pip docker
- name: pip docker-py - absent
pip:
name: docker-py
state: absent
executable: pip3
- name: pip docker - present
pip:
name: docker
- name: Hydra Config
docker_volume:
name: "{{ hydra_config }}"
state: present
- name: Volume Shared Downloads
docker_volume:
name: "{{ shared_downloads }}"
state: present
executable: pip3
- name: Hydra Network
docker_network:
@ -28,11 +27,12 @@
docker_container:
name: hydra
state: stopped
ignore_errors: yes
- name: Make Hydra
docker_container:
name: hydra
image: linuxserver/hydra2
image: 'linuxserver/hydra2:latest'
state: started
env:
PUID=1000
@ -41,7 +41,8 @@
ports:
- 5076:5076
volumes:
- "{{ hydra_config }}:/config"
#- "{{ hydra_config }}:/config"
- "/docker/hydra:/config"
- "{{ shared_downloads }}:/downloads"
networks:
- name: "{{ network }}"

View File

@ -0,0 +1,42 @@
- name: Configure Media Server
hosts: mediaserver
tasks:
- name: install docker
import_role:
name: geerlingguy.docker
become: yes
- name: make docker folder location
file:
path: /docker
state: directory
become: yes
- name: make docker config path
file:
path: /docker/config
state: directory
become: yes
- name: mount nfs to /docker/config
mount:
src: "192.168.0.16:/docker/"
path: /docker/config
fstype: nfs
boot: yes
state: mounted
become: yes
- name: install docker pip package
pip:
name: docker
state: present
executable: pip3
- name: make docker network
docker_network:
- name: mediaserver

View File

@ -0,0 +1,18 @@
---
- name: mount external nfs disks
hosts: mediaserver
vars_files:
- vars.yml
tasks:
- name: make mountpoint
file:
path: /docker/dockerconfig
state: directory
- name: mount /docker to /docker/dockerconfig
mount:
path: 192.168.0.16:/docker
src: /docker/dockerconfig
boot: yes
state: mounted

View File

@ -0,0 +1,35 @@
---
- name: nzbget
hosts: linux
become: yes
vars_files:
- vars.yml
tasks:
- name: pip docker
pip:
name: docker
executable: pip3
- name: stop nzb
docker_container:
name: nzbget
state: stopped
ignore_errors: yes
- name: Make Nzb
docker_container:
name: nzbget
image: linuxserver/nzbget:latest
state: started
env:
PUID=1000
PGID=1000
TZ=Europe/London
ports:
- 6789:6789
volumes:
- "/docker/config/nzbconfig:/config"
- "/docker/nzbdownloads:/downloads"
networks:
- name: "{{ network }}"

View File

@ -0,0 +1,37 @@
---
- name: sonarr
hosts: linux
become: yes
vars_files:
- vars.yml
tasks:
- name: pip docker
pip:
name: docker
- name: stop sonarr
docker_container:
name: sonarr
state: stopped
ignore_errors: yes
- name: start sonarr
docker_container:
name: sonarr
image: linuxserver/sonarr:latest
state: started
env:
PUID=1000
PGID=1000
TZ=Europe/London
UMASK_SET=022 #optional
ports:
- 8989:8989
volumes:
- "/docker/sonarr/config:/config"
- "/docker/sonarr/data:/tv"
- "/docker/nzbdownloads:/downloads"
networks:
- name: "{{ network }}"

View File

@ -1,4 +1,21 @@
---
# fstab info
mount_user: !vault |
$ANSIBLE_VAULT;1.1;AES256
38316431326133336166313838623232393765323137363737333161623262653632656664306266
3963633932616139616563386232323062623632313131620a613962623932303838663639373038
39333063363265616366343636366565386236626339663763323761363035623730333437646432
3463373232326334370a333033326637366534356430376637363861663133633634373832303032
6634
mount_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
37353436303838363038343639306636636165663335346166353133633935613235306235386336
3932313964333232333963623331373838393163616231320a323037653564303138633930323961
38646632663661616338643462346238363265323535383639616166396434663536626361663331
3166626638316561630a643465633938346431336430613235653465626231353831303961396134
3231
# Volumes
sonarr_data: sonarr_data
sonarr_config: sonarr_config

View File

@ -1,17 +0,0 @@
---
- name: enable
hosts: linux
tasks:
# https://galaxy.ansible.com/jnv/unattended-upgrades
- name: unattended-upgrades
become: true
include_role:
name: jnv.unattended-upgrades
vars:
#unattended_package_blacklist: []
unattended_automatic_reboot: true

34
playbook/linux/common.yml Normal file
View File

@ -0,0 +1,34 @@
---
# This is a common playbooks for all linux servers
# Contains all the basics needed for servers to get started
# Once this is installed and maintained look for server based roles like docker servers
- name: Install Linux Requirement
hosts: linux-all
become: yes
tasks:
- name: install packages
apt:
name: "{{ packages }}"
state: present
vars:
packages:
- python3
- python3-pip
- nfs-common
- tree
when: ansible_distribution == "Ubuntu"
- name: Install pip
include_role:
name: geerlingguy.pip
# https://galaxy.ansible.com/jnv/unattended-upgrades
- name: unattended-upgrades
become: true
include_role:
name: jnv.unattended-upgrades
vars:
#unattended_package_blacklist: []
unattended_automatic_reboot: true

View File

@ -1 +0,0 @@
deb https://artifacts.elastic.co/packages/7.x/apt stable main

View File

@ -1,40 +0,0 @@
---
# This will install all the client parts needed for elastic to monitor client computers
- name: Install elastic client programs
hosts: elasticClients
vars:
kibana_host: '192.168.0.173:5601'
elasticsearch_hosts: '["192.168.0.173:9200"]'
tasks:
- name: Install elastic repo
include: install-repo.yml
- name: Install elastic heartbeat
become: true
apt:
name: heartbeat-elastic
- name: Update Heatbeat config
become: true
template:
src: heartbeat.j2
dest: /etc/heartbeat/heartbeat.yml
- name: Configure elastic heartbeat
include: config-heartbeat.yml
- name: Install elastic metricbeat
become: true
apt:
name: metricbeat
- name: Update Metricbeat config
become: true
template:
src: metricbeat.j2
dest: /etc/metricbeat/metricbeat.yml
- name: Configure elastic metricbeat
include: config-metricbeat.yml

View File

@ -1,29 +0,0 @@
---
- name: Install Elastic GPG Key
become: true
apt_key:
url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch"
state: present
id: 46095ACC8548582C1A2699A9D27D666CD88E42B4
- name: Install apt-transport-https
become: true
apt:
name: apt-transport-https
- name: Add Elastic Repo
become: true
copy:
dest: '/etc/apt/sources.list.d/elastic-7.x.list'
content: "deb https://artifacts.elastic.co/packages/7.x/apt stable main"
# copy:
#src: elastic-7.x.list
# dest: /etc/apt/sources.list.d/
# backup: yes
- name: Update Packages
become: true
apt:
update_cache: true

View File

@ -1,14 +0,0 @@
- name: Install Filebeat
hosts: elasticClients
tasks:
- name: Install Filebeat
include_role:
name: luther38.filebeat
vars:
kibana_host: 172.20.0.142:5601
elasticsearch_hosts: "'172.20.0.142:9200'"
systemd_enabled: true
systemd_restart: true

View File

@ -1,16 +0,0 @@
---
- name: Install Metricbeat
hosts: elasticClients
tasks:
- name: Install Metricbeat
become: true
include_role:
name: luther38.metricbeat
vars:
kibana_host: 172.20.0.142
elasticsearch_hosts: '["172.20.0.142:9200"]'
systemd_enable_service: true
systemd_restart_service: true

View File

@ -1,16 +0,0 @@
---
- name: Install WinLogBeat
hosts: windows
tasks:
- name: Install WinLogBeat
become: true
include_role:
name: luther38.winlogbeat
vars:
version: 7.0.0
kibana_host: 172.20.0.142
elasticsearch_hosts: '["172.20.0.142:9200"]'

View File

@ -1,62 +0,0 @@
---
# This will install all elastic services for a elastic server
# ElasticSearch
# Kibana
- name: Install Elastic server programs
hosts: elastic
vars:
es_cluster_name: 'logging-dev'
es_node_name: 'dev-data-01'
es_node_master: 'true'
es_node_data: 'true'
es_path_data: '/var/lib/elasticsearch'
es_path_logs: '/var/log/elasticsearch'
es_http_port: '9200'
es_transport_host: 'localhost'
es_transport_port: '9300'
k_server_port: 5601
k_elasticsearch_hosts: 'http://192.168.0.173:9200'
tasks:
- name: Install Requrements
include: install-repo.yml
- name: Install ElasticSearch from apt
become: true
apt:
name: elasticsearch
- name: Update ElasticSearch config
become: true
template:
src: elasticsearch.j2
dest: /etc/elasticsearch/elasticsearch.yml
- name: Configure ElasticSearch
include: config-elasticsearch.yml
- name: Install Kibana from apt
become: true
apt:
name: kibana
- name: Configure Kibana
become: true
template:
src: kibana.j2
dest: /etc/kibana/kibana.yml
- name: Configure Kibana
include: config-kibana.yml
- name: Install Heartbeat
become: true
apt:
name: heartbeat
#- name: Install Logstash
#become: true
#apt:
#name: logstash

View File

@ -1,27 +0,0 @@
---
# This will install all the client parts needed for elastic to monitor client computers
- name: Install elastic client programs
hosts: windows
vars:
elastic_version: '7.0.0'
url_heartbeat: 'https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{{elastic_version}}-windows-x86_64.zip'
url_metricbeat: 'https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.0.0-windows-x86_64.zip'
url_winlogbeat: 'https://artifacts.elastic.co/downloads/beats/winlogbeat/winlogbeat-7.0.0-windows-x86_64.zip'
temp: 'c:\temp\'
program_files: 'c:\program files\'
kibana_host: '192.168.0.173:5601'
elasticsearch_hosts: '["192.168.0.173:9200"]'
tasks:
- name: make temp folder
win_file:
path: c:\temp\
state: directory
- name: Install Metricbeat
include: config-win-metricbeat.yml
- name: Install WinLogbeat
include: config-winlogbeat.yml

View File

@ -1,35 +0,0 @@
- name: testing elastic role
hosts: elastic
tasks:
- name: install/Update Java
become: true
import_role:
name: geerlingguy.java
- name: install elasticsearch
become: true
import_role:
name: elasticsearch
vars:
cluster_name: "loggin-dev"
ufw_http_port: true
ufw_transport_port: true
systemd_enabled: true
systemd_restart: true
node_name: "{{ ansible_hostname }}"
discovery_seed_hosts: "'127.0.0.1', '172.20.0.142', '192.168.0.173'"
cluster_initial_master_nodes: " '172.20.0.142', '192.168.0.173' "
- name: install kibana
become: true
import_role:
name: kibana
vars:
server_port: 5601
ufw_server_port: true
server_host: "{{ ansible_default_ipv4.address }}"
server_name: "{{ ansible_hostname }}"
elasticsearch_hosts: " 'http://localhost:9200', 'http://dm-nagios.local:9200', 'http://172.20.0.142:9200' "

View File

@ -32,12 +32,10 @@
- name: pip remove docker
pip:
name: docker
name: docker-py
state: absent
executable: pip
roles:
#- geerlingguy.repo-epel
- geerlingguy.git

View File

@ -1,34 +0,0 @@
- name: Install PowerShell Core
hosts: linux
#debugger: always
tasks:
- name: Check if PowerShell is installed
failed_when: "'Failed' PowerShell is already installed."
apt:
name: powershell
- name: Install Microsoft GPG Key
get_url:
url: https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
dest: /tmp/
- name: Register GPG Key
become: true
become_method: sudo
apt: deb="/tmp/packages-microsoft-prod.deb"
#command: dpkg -i ~/packages-microsoft-prod.deb
- name: Update repos and Install PowerShell Core
become: true
become_method: sudo
apt:
name: powershell
update_cache: yes
state: present
- name: Remove Extra files
file:
state: absent
path: /tmp/packages-microsoft-prod.deb