ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

commit d7115b71e81efe66619066346ef4d7fb899785cf
parent 62e787934f04e919438e0763ee91ce6da26280b1
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 23 Feb 2021 18:46:49 +0100

misc fixes
5 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/roles/bind/tasks/configure.yml b/roles/bind/tasks/configure.yml
@@ -15,6 +15,7 @@
     group: named
     state: directory
     recurse: yes
+  changed_when: false
 
 - name: "[Alpine] Generate named.conf"
   template:
diff --git a/roles/common/tasks/packages.yml b/roles/common/tasks/packages.yml
@@ -20,6 +20,7 @@
   template:
     src: repositories.j2
     dest: /etc/apk/repositories
+  register: apk_repos
   when:
     - ansible_distribution == "Alpine"
     - system.enableOwnRepos is defined 

@@ -45,15 +46,24 @@
     - system.enableOwnRepos is true
 
 
-- name: "[Alpine] Update system"
+- name: "[Alpine] Update repos"
   raw: "apk update && apk upgrade"
-  when: ansible_distribution == "Alpine"
+  when:
+    - ansible_distribution == "Alpine"
+    - apk_repos.changed
 
-- name: "[Archlinux] Update system"
+- name: "[Archlinux] Update repos"
   pacman:
     update_cache: yes
-    upgrade: yes
-  when: ansible_distribution == "Archlinux"
+  register: pacman_update
+  when:
+    - ansible_distribution == "Archlinux"
+
+- fail:
+    msg: "[Archlinux] Repos have been updated, please upgrade the system manually and restart the playbook"
+  when:
+    - ansible_distribution == "Archlinux"
+    - pacman_update.changed
 
 
 - name: "[Alpine] Install common packages"
diff --git a/roles/gitolite/tasks/configure.yml b/roles/gitolite/tasks/configure.yml
@@ -14,11 +14,6 @@
     cmd: gitolite setup -pk /var/lib/git/first-user-key.pub
     creates: /var/lib/git/.gitolite
 
-- name: Delete first-user-key.pub
-  file:
-    path: /var/lib/git/first-user-key.pub
-    state: absent
-
 - name: Unlock the git user
   ignore_errors: yes
   command:
diff --git a/roles/gitolite/tasks/install.yml b/roles/gitolite/tasks/install.yml
@@ -8,8 +8,10 @@
     - ansible_distribution == "Alpine" 
 
 - name: "[Archlinux] Install package: gitolite"
-  apk:
-    name: gitolite, git
+  pacman:
+    name:
+      - gitolite
+      - git
     state: present
   when: 
     - ansible_distribution == "Archlinux" 
diff --git a/roles/syncthing/tasks/start.yml b/roles/syncthing/tasks/start.yml
@@ -2,6 +2,7 @@
 
 - name: "Enable linger for user: {{ services.syncthing.user }}"
   command: "loginctl enable-linger {{ services.syncthing.user }}"
+  changed_when: false
   when:
     - ansible_service_mgr == "systemd"
     - services.syncthing.user is defined

@@ -38,7 +39,7 @@
     name: syncthing
     scope: user
     enabled: yes
-    state: restarted
+    state: started
   become: true
   become_user: "{{ services.syncthing.user }}"
   when: