add rclone role
This commit is contained in:
55
roles/rclone/tasks/main.yml
Normal file
55
roles/rclone/tasks/main.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
- name: Install the latest version
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- rclone
|
||||
state: latest
|
||||
|
||||
- name: Setup config files
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ item.path }}"
|
||||
block: "{{ item.content }}"
|
||||
create: true
|
||||
backup: true
|
||||
with_items: "{{ rclone_configs }}"
|
||||
|
||||
|
||||
- name: Creates directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.target }}"
|
||||
state: directory
|
||||
with_items: "{{ rclone_mounts }}"
|
||||
|
||||
|
||||
# needs rework
|
||||
# - ansible.builtin.lineinfile:
|
||||
# path: /etc/fstab
|
||||
# regexp: "#added by ansible role myLimbo.rclone - {{ item.source }}"
|
||||
# state: present
|
||||
# backup: true
|
||||
# line: |
|
||||
# #added by ansible role myLimbo.rclone - {{ item.source }}
|
||||
# with_items: "{{ mounts }}"
|
||||
|
||||
# - ansible.builtin.lineinfile:
|
||||
# path: /etc/fstab
|
||||
# insertafter: "#added by ansible role myLimbo.rclone - {{ item.source }}"
|
||||
# regexp: "^{{ item.source}} {{ item.target }} rclone"
|
||||
# line: |
|
||||
# {{ item.source}} {{ item.target }} rclone rw,nofail,_netdev,x-systemd.automount,args2env,vfs_cache_mode=off,config={{item.config_file}} 0 0
|
||||
# with_items: "{{ mounts }}"
|
||||
|
||||
|
||||
- name: Create a symbolic link
|
||||
ansible.builtin.file:
|
||||
src: /usr/bin/rclone
|
||||
dest: /sbin/mount.rclone
|
||||
owner: root
|
||||
group: root
|
||||
state: link
|
||||
|
||||
- name: reload systemd
|
||||
ansible.builtin.command: systemctl daemon-reload
|
||||
|
||||
- name: reload systemd
|
||||
ansible.builtin.command: mount -a
|
||||
Reference in New Issue
Block a user