Add rclone role
This commit is contained in:
parent
0779fbabef
commit
fd344fd385
9
roles/rclone/defaults/main.yaml
Normal file
9
roles/rclone/defaults/main.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
rclone_package_name: rclone
|
||||||
|
rclone_package_state: present
|
||||||
|
|
||||||
|
rclone_config_path: /etc/rclone
|
||||||
|
|
||||||
|
rclone_config: []
|
||||||
|
|
||||||
|
rclone_cron: []
|
5
roles/rclone/tasks/Debian.yaml
Normal file
5
roles/rclone/tasks/Debian.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: install package
|
||||||
|
apt:
|
||||||
|
deb: "{{ rclone_package_url }}"
|
||||||
|
|
41
roles/rclone/tasks/main.yaml
Normal file
41
roles/rclone/tasks/main.yaml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
- name: gather OS specific variables
|
||||||
|
include_vars: "{{ item }}"
|
||||||
|
with_first_found:
|
||||||
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
||||||
|
- "{{ ansible_distribution }}.yaml"
|
||||||
|
- "{{ ansible_os_family }}.yaml"
|
||||||
|
|
||||||
|
- name: OS specific tasks
|
||||||
|
include: "{{ item }}"
|
||||||
|
with_first_found:
|
||||||
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
||||||
|
- "{{ ansible_distribution }}.yaml"
|
||||||
|
- "{{ ansible_os_family }}.yaml"
|
||||||
|
|
||||||
|
- name: create configuration directory
|
||||||
|
file:
|
||||||
|
path: "{{ rclone_config_path }}"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: configure
|
||||||
|
template:
|
||||||
|
src: rclone.conf.j2
|
||||||
|
dest: "{{ rclone_config_path }}/{{ item.name }}.conf"
|
||||||
|
owner: "{{ item.owner | default('root') }}"
|
||||||
|
group: "{{ item.group | default('root') }}"
|
||||||
|
mode: "{{ item.mode | default('0600') }}"
|
||||||
|
with_items: "{{ rclone_config }}"
|
||||||
|
|
||||||
|
- name: cron jobs
|
||||||
|
cron:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
user: "{{ item.user | default('root') }}"
|
||||||
|
minute: "{{ item.minute | default(omit) }}"
|
||||||
|
hour: "{{ item.hour | default(omit) }}"
|
||||||
|
day: "{{ item.day | default(omit) }}"
|
||||||
|
month: "{{ item.month | default(omit) }}"
|
||||||
|
weekday: "{{ item.weekday | default(omit) }}"
|
||||||
|
job: "{{ item.job }}"
|
||||||
|
state: "{{ item.state | default('present') }}"
|
||||||
|
with_items: "{{ rclone_cron }}"
|
6
roles/rclone/templates/rclone.conf.j2
Normal file
6
roles/rclone/templates/rclone.conf.j2
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
[{{ item.name }}]
|
||||||
|
type = {{ item.type }}
|
||||||
|
account = {{ item.account }}
|
||||||
|
key = {{ item.key }}
|
2
roles/rclone/vars/Debian.yaml
Normal file
2
roles/rclone/vars/Debian.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
rclone_package_url: https://downloads.rclone.org/v1.50.1/rclone-v1.50.1-linux-amd64.deb
|
Loading…
Reference in New Issue
Block a user