Add support for RPM-based distros (CentOS, RHEL, Fedora)

This commit is contained in:
Manu 2019-05-27 18:12:13 +08:00
parent e30ce279c4
commit e809ec597d
6 changed files with 34 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# Ansible Role: BorgBackup Client # Ansible Role: BorgBackup Client
An Ansible Role that sets up automated remote backups on the target machine. Uses [BorgBackup](https://borgbackup.readthedocs.io/en/stable/) and [Borgmatic](https://github.com/witten/borgmatic). Currently supports Debian and Ubuntu. An Ansible Role that sets up automated remote backups on the target machine. Uses [BorgBackup](https://borgbackup.readthedocs.io/en/stable/) and [Borgmatic](https://github.com/witten/borgmatic). Currently supports Debian/Ubuntu and CentOS/RHEL/Fedora.
## Role Variables ## Role Variables

1
tasks/apt.yml Normal file
View File

@ -0,0 +1 @@
---

View File

@ -1,25 +1,23 @@
--- ---
- name: Regenerate apt-cache and update packages - include_vars: '{{ ansible_pkg_mgr }}.yml'
apt: - include: "{{ ansible_pkg_mgr }}.yml"
update_cache: yes
cache_valid_time: 120
- name: Install required System Packages - name: Install required System Packages
apt: package:
pkg: "{{ item }}" pkg: "{{ item }}"
state: installed state: installed
with_items: "{{ borg_apt_packages }}" with_items: "{{ borg_packages }}"
- name: Update setuptools if needed - name: Update setuptools if needed
pip: pip:
name: setuptools name: setuptools
state: latest state: latest
executable: pip3 executable: "{{ pip_bin }}"
- name: Install required Python Packages - name: Install required Python Packages
pip: pip:
name: "{{ item }}" name: "{{ item }}"
executable: pip3 executable: "{{ pip_bin }}"
with_items: "{{ borg_python_packages }}" with_items: "{{ borg_python_packages }}"
- name: Ensure root has SSH key. - name: Ensure root has SSH key.

6
tasks/yum.yml Normal file
View File

@ -0,0 +1,6 @@
---
- name: Install EPEL repo
yum:
pkg: epel-release
state: installed
update_cache: yes

View File

@ -1,5 +1,5 @@
--- ---
borg_apt_packages: borg_packages:
- libssl-dev - libssl-dev
- libacl1-dev - libacl1-dev
- libacl1 - libacl1
@ -8,6 +8,9 @@ borg_apt_packages:
- python3-pip - python3-pip
- python3-msgpack - python3-msgpack
python_bin: python3
pip_bin: pip3
borg_python_packages: borg_python_packages:
- borgbackup - borgbackup
- borgmatic - borgmatic

16
vars/yum.yml Normal file
View File

@ -0,0 +1,16 @@
---
borg_packages:
- libacl-devel
- libacl
- gcc
- gcc-c++
- openssl-devel
- python36-pip
- python36-devel
python_bin: python3
pip_bin: pip3
borg_python_packages:
- borgbackup
- borgmatic