1
0

Add rclone with eget and rclone docker plugin role

This commit is contained in:
Anton Vakhrushev 2024-12-23 15:26:32 +03:00
parent 4cd6d8ff64
commit 87e13973ec
Signed by: av
GPG Key ID: F5BF52FC352E255A
13 changed files with 172 additions and 5 deletions

View File

@ -10,6 +10,7 @@
- [ansible](https://docs.ansible.com/ansible/latest/getting_started/index.html)
- [invoke](https://www.pyinvoke.org/)
- [task](https://taskfile.dev/)
- [yq](https://github.com/mikefarah/yq)
## Установка
@ -27,6 +28,10 @@ $ ansible-galaxy install --role-file requirements.yml
- Чувствительные данные в `vars/vars.yaml` зашифрованы с помощью Ansible Vault.
- Для мониторинга за сервером устанавливается [netdata](https://github.com/netdata/netdata).
## Настройка DNS
В организации Яндекс: https://admin.yandex.ru/domains/vakhrushev.me?action=set_dns&uid=46045840
## Частые команды
Конфигурация приложений (если нужно добавить новое приложение):

View File

@ -18,6 +18,10 @@ tasks:
cmds:
- ssh {{.REMOTE_USER}}@{{.REMOTE_HOST}}
btop:
cmds:
- ssh {{.REMOTE_USER}}@{{.REMOTE_HOST}} -t btop
edit-vars:
cmds:
- ansible-vault edit vars/vars.yml

26
files/rclone.conf Normal file
View File

@ -0,0 +1,26 @@
$ANSIBLE_VAULT;1.1;AES256
66626231663733396232343163306138366434663364373937396137313134373033626539356166
3038316664383731623635336233393566636234636532630a393234336561613133373662383161
33653330663364363832346331653037663363643238326334326431336331373936666162363561
3064656630666431330a626430353063313866663730663236343437356661333164653636376538
62303164393766363933336163386663333030336132623661346565333861313537333566346563
32666436383335353866396539663936376134653762613137343035376639376135616334326161
62343366313032306664303030323433666230333665386630383635633863303366313639616462
38643466356666653337383833366565633932613539666563653634643063663166623337303865
64303365373932346233653237626363363964366431663966393937343966633735356563373735
66366464346436303036383161316466323639396162346537653134626663303662326462656563
63343065323636643266396532333331333137303131373633653233333837656665346635373564
62613733613634356335636663336634323463376266373665306232626330363132313362373032
30613366626563383236636262656135613431343639633339336135353362373665326264633438
65306539663166623533336531356639306235346566313764343835643437663963613639326430
36303031346339366561366166386532373838623635663837663466643032653930613635666237
38313235343662623733613637616164366134613635343135646439623464623233303330333361
62623166376337343838636564383633646432653436646236363262316438613333616236656532
37336539343130343133626262616634303561326631363564353064336130613666353531646237
66373036363764653435326638313036653135396362666439623431313930633539613965333263
39383937616165333962366134343936323930386233356662303864643236396562313339313739
64303934336164333563623263323236663531613265383833336239306435333735396666633666
30663566653361343238306133613839333962373838623633363138353331616264363064316433
36663233643134353333623264643238396438366633376530336134313365323832346663316535
66653436323338636565303133316637353338346366633564306230386632373235653836626338
3935

View File

@ -23,3 +23,7 @@
- "docker-{{ docker_edition }}-rootless-extras"
docker_users:
- major
- name: 'Install rclone plugin'
ansible.builtin.import_role:
name: docker_rclone_plugin

View File

@ -14,3 +14,13 @@
vars:
eget_version: '1.3.4'
eget_install_path: '/usr/bin/eget'
- name: 'Install rclone with eget'
ansible.builtin.command:
cmd: '/usr/bin/eget rclone/rclone --quiet --upgrade-only --to /usr/bin --tag v1.68.2 --asset zip'
changed_when: false
- name: 'Install btop with eget'
ansible.builtin.command:
cmd: '/usr/bin/eget aristocratos/btop --quiet --upgrade-only --to /usr/bin --tag v1.4.0'
changed_when: false

View File

@ -9,8 +9,12 @@
vars:
apt_packages:
- acl
- curl
- fuse
- git
- htop
- jq
- make
- python3-pip
tasks:

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,3 @@
---
docker_rclone_plugin_config: './files/rclone.conf'

View File

@ -0,0 +1,2 @@
---
# handlers file for docker_rclone_plugin

View File

@ -0,0 +1,51 @@
galaxy_info:
author: 'Anton Vakhrushev'
description: 'Rclone docker plugin'
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: 'MIT'
min_ansible_version: '2.1'
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,23 @@
---
- name: 'Create required plugin directories'
ansible.builtin.file:
path: '{{ item }}'
state: 'directory'
mode: '0755'
loop:
- '/var/lib/docker-plugins/rclone/config'
- '/var/lib/docker-plugins/rclone/cache'
- name: 'Install docker plugin'
community.docker.docker_plugin:
plugin_name: 'rclone/docker-volume-rclone:amd64'
alias: 'rclone'
state: 'present'
plugin_options:
args: '-v'
- name: 'Copy rclone config'
ansible.builtin.copy:
src: '{{ docker_rclone_plugin_config }}'
dest: '/var/lib/docker-plugins/rclone/config/rclone.conf'
mode: '0644'

View File

@ -1,8 +1,4 @@
---
# - name: 'Begin installation'
# ansible.builtin.debug:
# msg: 'Begin installation'
- name: 'Download eget from url "{{ eget_download_url }}"'
ansible.builtin.get_url:
url: '{{ eget_download_url }}'
@ -13,6 +9,7 @@
ansible.builtin.unarchive:
src: '{{ eget_download_dest }}'
dest: '/tmp'
list_files: true
remote_src: true
- name: 'Install eget binary'

View File

@ -8,7 +8,7 @@
ignore_errors: true
changed_when: false
- name: 'Check eget installed --version'
- name: 'Check eget installed version'
ansible.builtin.set_fact:
eget_need_install: '{{ not (eget_installed_output.rc == 0 and eget_version in eget_installed_output.stdout) }}'