remove cronjob for non root user and added become

This commit is contained in:
2022-11-20 17:53:48 +01:00
parent 4beb5401cf
commit e06d0abe2e

View File

@@ -2,12 +2,14 @@
- hosts: all - hosts: all
tasks: tasks:
- name: "update git url" - name: "update git url"
become: yes become: true
become_user: root
command: command:
cmd: "git remote set-url origin ssh://git@gitea.mewissen.site:22422/rene/dotfiles.git" cmd: "git remote set-url origin ssh://git@gitea.mewissen.site:22422/rene/dotfiles.git"
chdir: "{{ ansible_user_dir }}/dotfiles" chdir: "{{ ansible_user_dir }}/dotfiles"
- name: "git default settings" - name: "git default settings"
become: yes become: true
become_user: root
command: command:
cmd: "git config pull.rebase false" cmd: "git config pull.rebase false"
chdir: "{{ ansible_user_dir }}/dotfiles" chdir: "{{ ansible_user_dir }}/dotfiles"
@@ -16,8 +18,18 @@
# command: # command:
# cmd: "git pull" # cmd: "git pull"
# chdir: "{{ ansible_user_dir }}/dotfiles" # 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" - name: "add cronjob for ansible"
become: yes become: true
become_user: root
cron: cron:
name: "ansible provision" name: "ansible provision"
user: "{{ ansible_user_id }}" user: "{{ ansible_user_id }}"
@@ -26,6 +38,7 @@
minute: 0 minute: 0
hour: 1 hour: 1
- name: "update ansible-pull once" - name: "update ansible-pull once"
become: yes become: true
become_user: root
command: command:
cmd: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master' cmd: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master'