diff --git a/all.yml b/all.yml index aa4a01b..2f941f4 100644 --- a/all.yml +++ b/all.yml @@ -3,7 +3,10 @@ hosts: all roles: - - ansible-pull + - role: ansible-pull + vars: + ansible_pull_timer_enabled: true + ansible_pull_timer_started: true - common - name: ASPP user setup diff --git a/roles/ansible-pull/defaults/main.yml b/roles/ansible-pull/defaults/main.yml new file mode 100644 index 0000000..c20301f --- /dev/null +++ b/roles/ansible-pull/defaults/main.yml @@ -0,0 +1,3 @@ +--- +ansible_pull_timer_started: false +ansible_pull_timer_enabled: false diff --git a/roles/ansible-pull/tasks/main.yml b/roles/ansible-pull/tasks/main.yml index e10bc91..db076bf 100644 --- a/roles/ansible-pull/tasks/main.yml +++ b/roles/ansible-pull/tasks/main.yml @@ -87,30 +87,32 @@ Environment=ANSIBLE_CALLBACK_PLUGINS=/usr/lib/python3.12/site-packages/ara/plugins/callback tags: remote -- name: Enable ansible-pull-init.timer manually - ansible.builtin.file: - src: /usr/local/lib/systemd/system/ansible-pull-init.timer - dest: /etc/systemd/system/multi-user.target.wants/ansible-pull-init.timer - state: link - -- name: Enable ansible-pull-repeat.timer manually - ansible.builtin.file: - src: /usr/local/lib/systemd/system/ansible-pull-repeat.timer - dest: /etc/systemd/system/multi-user.target.wants/ansible-pull-repeat.timer - state: link - - name: Enable ansible-pull-init.timer ansible.builtin.systemd_service: name: ansible-pull-init.timer - enabled: true - state: started + enabled: "{{ ansible_pull_timer_enabled }}" + daemon_reload: true + tags: remote + +- name: Enable ansible-pull-repeat.timer + ansible.builtin.systemd_service: + name: ansible-pull-repeat.timer + enabled: "{{ ansible_pull_timer_enabled }}" daemon_reload: true tags: remote + +- name: Enable ansible-pull-init.timer + ansible.builtin.systemd_service: + name: ansible-pull-init.timer + state: "started" + tags: remote + when: ansible_pull_timer_started + - name: Enable ansible-pull-repeat.timer ansible.builtin.systemd_service: name: ansible-pull-repeat.timer - enabled: true - state: started + state: "started" daemon_reload: true tags: remote + when: ansible_pull_timer_started