diff --git a/README.md b/README.md index 9dcb43e..cb2578a 100644 --- a/README.md +++ b/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 diff --git a/tasks/apt.yml b/tasks/apt.yml new file mode 100644 index 0000000..73b314f --- /dev/null +++ b/tasks/apt.yml @@ -0,0 +1 @@ +--- \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 81a81da..d8818f9 100755 --- a/tasks/main.yml +++ b/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. diff --git a/tasks/yum.yml b/tasks/yum.yml new file mode 100644 index 0000000..3ee3f16 --- /dev/null +++ b/tasks/yum.yml @@ -0,0 +1,6 @@ +--- +- name: Install EPEL repo + yum: + pkg: epel-release + state: installed + update_cache: yes \ No newline at end of file diff --git a/vars/main.yml b/vars/apt.yml similarity index 77% rename from vars/main.yml rename to vars/apt.yml index 151e009..04a3b0d 100644 --- a/vars/main.yml +++ b/vars/apt.yml @@ -1,5 +1,5 @@ --- -borg_apt_packages: +borg_packages: - libssl-dev - libacl1-dev - libacl1 @@ -8,6 +8,9 @@ borg_apt_packages: - python3-pip - python3-msgpack +python_bin: python3 +pip_bin: pip3 + borg_python_packages: - borgbackup - borgmatic \ No newline at end of file diff --git a/vars/yum.yml b/vars/yum.yml new file mode 100644 index 0000000..3d5871c --- /dev/null +++ b/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 \ No newline at end of file