diff options
author | Julien Dessaux | 2021-02-16 15:11:40 +0100 |
---|---|---|
committer | Julien Dessaux | 2021-02-16 15:11:40 +0100 |
commit | 91b773e12e4de07244efb6bfcfde53d1573d1e54 (patch) | |
tree | 2b9b960ec7a8c7acc7d3c2fa7004fdc891c6f48d | |
parent | Revitalized the borg role (diff) | |
download | borg-ansible-role-91b773e12e4de07244efb6bfcfde53d1573d1e54.tar.gz borg-ansible-role-91b773e12e4de07244efb6bfcfde53d1573d1e54.tar.bz2 borg-ansible-role-91b773e12e4de07244efb6bfcfde53d1573d1e54.zip |
Added action plugins to simplify borg role
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | tasks/main.yml | 4 |
2 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,4 @@ There are several variables you can define to configure a machines response to the borg role : -- is_borg_server: a boolean that indicates if a machine will act as a borg server - borg_server: a string that contains a borg servers hostname - borg_jobs: a list of dict, one item per job with the following keys: - name: the name of the borg job @@ -14,3 +13,5 @@ Here are some job examples : - { name: etc, path: "/etc" } - { name: mysqldump, command_to_pipe: "/usr/bin/mysqldump -h {{ mysql_server }} -u{{ ansible_hostname }} -p{{ ansible_local.mysql_client.password }} --single-transaction --add-drop-database -B {{ ansible_hostname }}" } - { name: gitea, path: "/tmp/gitea.zip", pre_command: "echo '/usr/local/sbin/gitea -C /etc/gitea -c /etc/gitea/app.ini dump -f /tmp/gitea.zip' | su -l _gitea", post_command: "rm -f /tmp/gitea.zip" } + +There is an action plugin that parses the borg_server entries from all hosts and set a flag to True in adyxax['is_borg_server'] for any machine specified as a backup target diff --git a/tasks/main.yml b/tasks/main.yml index e49b440..91910ef 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,9 @@ --- - import_tasks: common.yml - when: (is_borg_server|default(false)) or borg_server is defined + when: adyxax['is_borg_server'] or borg_server is defined - import_tasks: server.yml - when: (is_borg_server|default(false)) + when: adyxax['is_borg_server'] - import_tasks: client.yml when: borg_server is defined |