Add crontab configuration

Install a default crontab configuration, as part of our installation
process.

Change-Id: Ibd1b9a91b0a9a31d0a95ed6b34f760a01bd5ba03
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-02-17 16:08:35 -05:00
parent b12d697e79
commit 849f134003
5 changed files with 28 additions and 1 deletions

View File

@ -29,6 +29,12 @@ borgmatic_file_config_yaml_mode: 0640
borgmatic_file_config_yaml_owner: "{{ borgmatic_user_name }}"
borgmatic_file_config_yaml_src: root/.config/borgmatic/config.yaml.j2
borgmatic_file_crontab_dest: /etc/cron.d/borgmatic
borgmatic_file_crontab_group: root
borgmatic_file_crontab_mode: 0644
borgmatic_file_crontab_owner: root
borgmatic_file_crontab_src: etc/cron.d/borgmatic.j2
# tasks/install.yaml
borgmatic_git_dest: "{{ ansible_user_dir }}/src/github.com/witten/borgmatic"
borgmatic_git_uri: https://github.com/witten/borgmatic

View File

@ -6,4 +6,4 @@ FROM {{ item.registry.url }}/{{ item.image }}
FROM {{ item.image }}
{% endif %}
RUN apt-get update && apt-get install -y python sudo bash ca-certificates python-pip python3-pip && apt-get clean;
RUN apt-get update && apt-get install -y python sudo bash ca-certificates cron python-pip python3-pip && apt-get clean;

View File

@ -30,6 +30,14 @@ def test_borgmatic_config(host):
assert f.mode == 0o640
del f
f = host.file('/etc/cron.d/borgmatic')
assert f.exists
assert f.is_file
assert f.user == 'root'
assert f.group == 'root'
assert f.mode == 0o644
del f
def test_borgmatic_version(host):
host.check_output('borgmatic --version')

View File

@ -29,3 +29,12 @@
mode: "{{ borgmatic_file_config_yaml_mode }}"
owner: "{{borgmatic_file_config_yaml_owner }}"
src: "{{ borgmatic_file_config_yaml_src }}"
- name: Install borgmatic crontab
become: true
template:
dest: "{{ borgmatic_file_crontab_dest }}"
group: "{{ borgmatic_file_crontab_group }}"
mode: "{{ borgmatic_file_crontab_mode }}"
owner: "{{borgmatic_file_crontab_owner }}"
src: "{{ borgmatic_file_crontab_src }}"

View File

@ -0,0 +1,4 @@
# This file is generated by Ansible
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
0 3 * * * {{ borgmatic_user_name }} {{ borgmatic_pip_virtualenv | default('/usr/local') }}/bin/borgmatic