diff --git a/README.md b/README.md index bb193fe..f74e9f7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/borgbase/ansible-role-borgbackup.svg?branch=master)](https://travis-ci.org/borgbase/ansible-role-borgbackup) [![Ansible Galaxy](https://img.shields.io/ansible/role/30531)](https://galaxy.ansible.com/m3nu/ansible_role_borgbackup) -Set up encrypted, compressed and deduplicated backups using [BorgBackup](https://borgbackup.readthedocs.io/en/stable/) and [Borgmatic](https://github.com/witten/borgmatic). Currently supports Debian/Ubuntu and CentOS/RHEL/Fedora. +Set up encrypted, compressed and deduplicated backups using [BorgBackup](https://borgbackup.readthedocs.io/en/stable/) and [Borgmatic](https://github.com/witten/borgmatic). Currently supports Debian/Ubuntu and CentOS/Red Hat. Works great with [BorgBase.com](https://www.borgbase.com) - Simple and Secure Hosting for your Borg Repositories. diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 index 0de39e6..80a5c31 100644 --- a/molecule/default/Dockerfile.j2 +++ b/molecule/default/Dockerfile.j2 @@ -14,9 +14,9 @@ ENV {{ var }} {{ value }} {% endfor %} {% endif %} -RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 python-apt aptitude && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install /usr/bin/python3 /usr/bin/python3-config /usr/bin/dnf-3 sudo bash iproute && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y /usr/bin/python /usr/bin/python2-config sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ - elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi \ No newline at end of file diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 5012ed2..efe7803 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -8,14 +8,20 @@ lint: platforms: - name: centos-7 image: centos:7 - # - name: centos-latest - # image: centos:latest + - name: centos-latest + image: centos:latest + # - name: fedora-latest # epel package not available + # image: fedora:latest - name: debian-oldstable image: debian:oldstable - name: debian-stable image: debian:stable - # - name: ubuntu-latest - # image: ubuntu:latest + - name: ubuntu-xenial + image: ubuntu:xenial + # - name: ubuntu-trusty # Python too old + # image: ubuntu:trusty + - name: ubuntu-latest + image: ubuntu:latest provisioner: name: ansible lint: diff --git a/tasks/apt.yml b/tasks/Debian.yml similarity index 100% rename from tasks/apt.yml rename to tasks/Debian.yml diff --git a/tasks/yum.yml b/tasks/RedHat.yml similarity index 100% rename from tasks/yum.yml rename to tasks/RedHat.yml diff --git a/tasks/main.yml b/tasks/main.yml index 5fe512d..72ebbf3 100755 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,15 @@ --- - name: Include OS-specific variables - include_vars: '{{ ansible_pkg_mgr }}.yml' + include_vars: "{{ item }}" + with_first_found: + - "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_os_family }}.yml" - name: Run OS-specific setup - include: "{{ ansible_pkg_mgr }}.yml" + include: "{{ item }}" + with_first_found: + - "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_os_family }}.yml" - name: Install required System Packages package: diff --git a/vars/apt.yml b/vars/Debian.yml similarity index 100% rename from vars/apt.yml rename to vars/Debian.yml diff --git a/vars/RedHat-8.yml b/vars/RedHat-8.yml new file mode 100644 index 0000000..90b9760 --- /dev/null +++ b/vars/RedHat-8.yml @@ -0,0 +1,21 @@ +--- +borg_packages: + - libacl-devel + - libacl + - gcc + - gcc-c++ + - openssl-devel + - python3-pip + - python3-wheel + - python3-devel + - python3-setuptools + - openssh-clients + - cronie + +python_bin: python3 +pip_bin: pip3 + +borg_python_packages: + - cython + - borgbackup + - borgmatic diff --git a/vars/yum.yml b/vars/RedHat.yml similarity index 100% rename from vars/yum.yml rename to vars/RedHat.yml