diff --git a/README.md b/README.md index 00a7c2c..8b5fa80 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Ansible Role: Restic [![Build Status](https://travis-ci.com/hadret/ansible-role-restic.svg?branch=master)](https://travis-ci.com/hadret/ansible-role-restic) -An Ansible role that installs [restic](https://restic.net) on Linux. +An Ansible role that installs [restic](https://restic.net) on Linux & FreeBSD. Requirements ------------ diff --git a/defaults/main.yml b/defaults/main.yml index 1208e35..6457d85 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,9 +4,6 @@ restic_install_path: '/usr/local/bin' restic_password_file_path: '/root' restic_discard_cron_stdout: false -restic_user: root -restic_group: "{{ restic_user }}" - restic_repos: [] # restic_repos: # - name: s3-example diff --git a/meta/main.yml b/meta/main.yml index b747f92..3096489 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,7 +4,7 @@ dependencies: [] galaxy_info: role_name: restic author: donat-b, Pawel Krupa (paulfantom), Filip Chabik (hadret) - description: Restic installation for Ubuntu Linux. + description: Restic installation for Linux & FreeBSD. license: MIT min_ansible_version: 2.7 platforms: @@ -16,6 +16,12 @@ galaxy_info: - xenial - bionic - focal + - name: FreeBSD + versions: + - 11.4 + - 12.1 + - 12.2 + - 13.0 galaxy_tags: - restic - backup diff --git a/tasks/main.yml b/tasks/main.yml index 32bd4ea..8f5f059 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,17 @@ --- +- name: include OS-specific variables + include_vars: "{{ ansible_os_family }}.yml" + +- name: define restic_user. + set_fact: + restic_user: "{{ __restic_user }}" + when: restic_user is not defined + +- name: define restic_group + set_fact: + restic_group: "{{ __restic_group }}" + when: restic_group is not defined + - name: ensure restic group is present group: name: "{{ restic_group }}" @@ -57,6 +70,7 @@ path: "{{ restic_install_path }}/restic" capability: cap_dac_read_search+ep state: present + when: ansible_system == "Linux" become: true - name: deploy password files diff --git a/vars/Debian.yml b/vars/Debian.yml new file mode 100644 index 0000000..d1fbf52 --- /dev/null +++ b/vars/Debian.yml @@ -0,0 +1,3 @@ +--- +__restic_user: "root" +__restic_group: "{{ __restic_user }}" diff --git a/vars/FreeBSD.yml b/vars/FreeBSD.yml new file mode 100644 index 0000000..dbe78eb --- /dev/null +++ b/vars/FreeBSD.yml @@ -0,0 +1,3 @@ +--- +__restic_user: "root" +__restic_group: "wheel"