1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-24 08:52:31 +02:00

update aria2 playbook

This commit is contained in:
kev 2016-03-22 19:45:44 +08:00
parent 15c1eceed7
commit 292993dfab

View File

@ -9,10 +9,14 @@
tasks:
- name: ensure aria2 is installed
- name: ensure softwares are installed
apt:
name: aria2
name: '{{item}}'
state: present
with_items:
- aria2
- nginx
- samba
- name: create aria2 service file
copy:
@ -20,10 +24,10 @@
[Unit]
Description=High speed download utility
After=network.target
[Service]
User=pi
Environment=DIR=/home/pi/Downloads
Environment=DIR=/home/pi/share
ExecStartPre=/bin/mkdir -p ${DIR}
ExecStart=/usr/bin/aria2c --enable-rpc \
--rpc-listen-all=true \
@ -34,23 +38,19 @@
[Install]
WantedBy=multi-user.target
dest: /etc/systemd/system/aria2.service
notify:
- reload systemd
- restart aria2
- name: ensure aria2 is running
- name: ensure services are running
service:
name: aria2
state: started
enabled: yes
- name: ensure nginx is installed
apt:
name: nginx
state: present
- name: ensure nginx is running
service:
name: nginx
name: '{{item}}'
state: started
enabled: yes
with_items:
- aria2
- nginx
- smbd
- name: create nginx yaaw site
copy:
@ -64,9 +64,9 @@
root /var/www/yaaw-master;
}
location /dl {
location /share {
autoindex on;
alias /home/pi/Downloads;
alias /home/pi/share;
}
}
dest: /etc/nginx/sites-available/yaaw
@ -91,8 +91,36 @@
- restart nginx
changed_when: yes
- name: update samba config
blockinfile:
dest: /etc/samba/smb.conf
insertafter: EOF
content: |
[share]
path = /home/pi/share
browseable = yes
read only = yes
guest ok = yes
notify:
- restart samba
changed_when: yes
handlers:
- name: reload systemd
command: systemctl daemon-reload
- name: restart aria2
service:
name: aria2
state: restarted
- name: restart nginx
service:
name: nginx
state: restarted
- name: restart samba
service:
name: smbd
state: restarted