From e06d0abe2e1b436f354130d87a01c089a1573ef6 Mon Sep 17 00:00:00 2001 From: Rene Date: Sun, 20 Nov 2022 17:53:48 +0100 Subject: [PATCH] remove cronjob for non root user and added become --- update.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/update.yml b/update.yml index 0da78e8..4555dc2 100644 --- a/update.yml +++ b/update.yml @@ -2,12 +2,14 @@ - hosts: all tasks: - name: "update git url" - become: yes + become: true + become_user: root command: cmd: "git remote set-url origin ssh://git@gitea.mewissen.site:22422/rene/dotfiles.git" chdir: "{{ ansible_user_dir }}/dotfiles" - name: "git default settings" - become: yes + become: true + become_user: root command: cmd: "git config pull.rebase false" chdir: "{{ ansible_user_dir }}/dotfiles" @@ -16,8 +18,18 @@ # command: # cmd: "git pull" # chdir: "{{ ansible_user_dir }}/dotfiles" + - name: "remove cronjob for ansible" + become: no + cron: + name: "ansible provision" + user: "{{ ansible_user_id }}" + job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master' + state: present + minute: 0 + hour: 1 - name: "add cronjob for ansible" - become: yes + become: true + become_user: root cron: name: "ansible provision" user: "{{ ansible_user_id }}" @@ -26,6 +38,7 @@ minute: 0 hour: 1 - name: "update ansible-pull once" - become: yes + become: true + become_user: root command: cmd: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master' \ No newline at end of file