-
Notifications
You must be signed in to change notification settings - Fork 0
/
pi-plex.yml
84 lines (73 loc) · 1.93 KB
/
pi-plex.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
- hosts: localhost
vars:
router: '192.168.2.1'
pi_hostname: 'plexpi'
pi_ip: '192.168.2.90'
printer_ip: '192.168.2.196'
nfs:
options: '_netdev,intr,v4,sec=sys'
mounts:
- {target: '/mnt/Multimedia', src: '192.168.2.111:/Multimedia'}
apts:
- vim
- git
- jq
- make
- tmux
- screen
- ntp
- apt-transport-https
tasks:
- name: get hostname via raspi-config
shell: "raspi-config nonint get_hostname"
register: raspi_hostname
changed_when: False
check_mode: no
tags:
- raspi
- name: get ethernet ip via ifconfig
shell: "ifconfig eth0 | grep inet | awk '{ print $2 }' | head -1"
register: raspi_ip
changed_when: False
check_mode: no
tags:
- raspi
- name: get ssh enabled status
shell: "raspi-config nonint get_ssh"
register: raspi_ssh_disabled
changed_when: False
check_mode: no
tags:
- raspi
- name: set raspi-config facts (all)
set_fact:
raspi_hostname: "{{ raspi_hostname.stdout }}"
raspi_ip: "{{ raspi_ip.stdout }}"
- name: set hostname
become: yes
shell: "raspi-config nonint do_hostname {{ pi_hostname }}"
when: raspi_hostname != pi_hostname
# - name: enable ssh
# become: yes
# shell: "raspi-config nonint do_ssh 0"
# when: raspi_ssh_disabled != 0
- name: install PKGs
become: yes
apt:
name: "{{ apts }}"
state: latest
- name: Ensure NFS mount points exist
become: yes
action: file path={{item.target}} state=directory
with_items: "{{ nfs.mounts }}"
tags:
- nfs
- name: Setup NFS mount points
become: yes
mount: name="{{item.target}}" src="{{item.src}}" fstype=nfs opts="{{nfs.options}}" state=mounted
with_items: "{{ nfs.mounts }}"
tags:
- nfs
- name: Make sure NTP is started up
service: name=ntp state=started enabled=yes
tags: ntp