1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-28 09:08:50 +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: tasks:
- name: ensure aria2 is installed - name: ensure softwares are installed
apt: apt:
name: aria2 name: '{{item}}'
state: present state: present
with_items:
- aria2
- nginx
- samba
- name: create aria2 service file - name: create aria2 service file
copy: copy:
@ -20,10 +24,10 @@
[Unit] [Unit]
Description=High speed download utility Description=High speed download utility
After=network.target After=network.target
[Service] [Service]
User=pi User=pi
Environment=DIR=/home/pi/Downloads Environment=DIR=/home/pi/share
ExecStartPre=/bin/mkdir -p ${DIR} ExecStartPre=/bin/mkdir -p ${DIR}
ExecStart=/usr/bin/aria2c --enable-rpc \ ExecStart=/usr/bin/aria2c --enable-rpc \
--rpc-listen-all=true \ --rpc-listen-all=true \
@ -34,23 +38,19 @@
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
dest: /etc/systemd/system/aria2.service dest: /etc/systemd/system/aria2.service
notify:
- reload systemd
- restart aria2
- name: ensure aria2 is running - name: ensure services are running
service: service:
name: aria2 name: '{{item}}'
state: started
enabled: yes
- name: ensure nginx is installed
apt:
name: nginx
state: present
- name: ensure nginx is running
service:
name: nginx
state: started state: started
enabled: yes enabled: yes
with_items:
- aria2
- nginx
- smbd
- name: create nginx yaaw site - name: create nginx yaaw site
copy: copy:
@ -64,9 +64,9 @@
root /var/www/yaaw-master; root /var/www/yaaw-master;
} }
location /dl { location /share {
autoindex on; autoindex on;
alias /home/pi/Downloads; alias /home/pi/share;
} }
} }
dest: /etc/nginx/sites-available/yaaw dest: /etc/nginx/sites-available/yaaw
@ -91,8 +91,36 @@
- restart nginx - restart nginx
changed_when: yes 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: handlers:
- name: reload systemd
command: systemctl daemon-reload
- name: restart aria2
service:
name: aria2
state: restarted
- name: restart nginx - name: restart nginx
service: service:
name: nginx name: nginx
state: restarted state: restarted
- name: restart samba
service:
name: smbd
state: restarted