Skip to content

Commit

Permalink
Add support for RPM-based distros (CentOS, RHEL, Fedora)
Browse files Browse the repository at this point in the history
  • Loading branch information
m3nu committed May 27, 2019
1 parent e30ce27 commit e809ec5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# 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

Expand Down
1 change: 1 addition & 0 deletions tasks/apt.yml
@@ -0,0 +1 @@
---
14 changes: 6 additions & 8 deletions tasks/main.yml
@@ -1,25 +1,23 @@
---
- name: Regenerate apt-cache and update packages
apt:
update_cache: yes
cache_valid_time: 120
- include_vars: '{{ ansible_pkg_mgr }}.yml'
- include: "{{ ansible_pkg_mgr }}.yml"

- name: Install required System Packages
apt:
package:
pkg: "{{ item }}"
state: installed
with_items: "{{ borg_apt_packages }}"
with_items: "{{ borg_packages }}"

- name: Update setuptools if needed
pip:
name: setuptools
state: latest
executable: pip3
executable: "{{ pip_bin }}"

- name: Install required Python Packages
pip:
name: "{{ item }}"
executable: pip3
executable: "{{ pip_bin }}"
with_items: "{{ borg_python_packages }}"

- name: Ensure root has SSH key.
Expand Down
6 changes: 6 additions & 0 deletions tasks/yum.yml
@@ -0,0 +1,6 @@
---
- name: Install EPEL repo
yum:
pkg: epel-release
state: installed
update_cache: yes
5 changes: 4 additions & 1 deletion vars/main.yml → vars/apt.yml
@@ -1,5 +1,5 @@
---
borg_apt_packages:
borg_packages:
- libssl-dev
- libacl1-dev
- libacl1
Expand All @@ -8,6 +8,9 @@ borg_apt_packages:
- python3-pip
- python3-msgpack

python_bin: python3
pip_bin: pip3

borg_python_packages:
- borgbackup
- borgmatic
16 changes: 16 additions & 0 deletions vars/yum.yml
@@ -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

0 comments on commit e809ec5

Please sign in to comment.