aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-09-11 11:12:01 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-09-11 11:12:01 +0200
commitdfc2bdca165de86de9ab859b32dc405b0e75e5b3 (patch)
tree14d55775f79357012a864a2522d6c0b21b3a1d5b
parentetckeeper: configure the thing, not just check (diff)
downloadinfra-ansible-dfc2bdca165de86de9ab859b32dc405b0e75e5b3.tar.gz
infra-ansible-dfc2bdca165de86de9ab859b32dc405b0e75e5b3.zip
etckeeper: configure git remote as well
-rw-r--r--roles/etckeeper/defaults/main.yml3
-rw-r--r--roles/etckeeper/tasks/main.yml26
2 files changed, 29 insertions, 0 deletions
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 }}'