From dfc2bdca165de86de9ab859b32dc405b0e75e5b3 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 11 Sep 2023 11:12:01 +0200 Subject: etckeeper: configure git remote as well --- roles/etckeeper/defaults/main.yml | 3 +++ roles/etckeeper/tasks/main.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'roles/etckeeper') diff --git a/roles/etckeeper/defaults/main.yml b/roles/etckeeper/defaults/main.yml index 077855f..176453c 100644 --- a/roles/etckeeper/defaults/main.yml +++ b/roles/etckeeper/defaults/main.yml @@ -1,2 +1,5 @@ git_name: Egor Tensin git_email: Egor.Tensin@gmail.com + +etckeeper_remote_name: origin +#etckeeper_remote_url: diff --git a/roles/etckeeper/tasks/main.yml b/roles/etckeeper/tasks/main.yml index f7d9427..6752f92 100644 --- a/roles/etckeeper/tasks/main.yml +++ b/roles/etckeeper/tasks/main.yml @@ -46,3 +46,29 @@ value: '1' - name: AVOID_COMMIT_BEFORE_INSTALL value: '1' + +- name: Configure repository remote + when: etckeeper_remote_url is defined + become: true + block: + - name: git remote add + ansible.builtin.command: + argv: + - git + - remote + - add + - '{{ etckeeper_remote_name }}' + - '{{ etckeeper_remote_url }}' + chdir: /etc + creates: '/etc/.git/refs/remotes/{{ etckeeper_remote_name }}/' + + - name: Configure pushes for etckeeper + community.general.ini_file: + path: /etc/etckeeper/etckeeper.conf + no_extra_spaces: true + owner: root + group: root + mode: '644' + section: null + option: PUSH_REMOTE + value: '{{ etckeeper_remote_name }}' -- cgit v1.2.3