diff --git a/files/update_puppet_code.timer b/files/update_puppet_code.timer index 32fadfa..6b2efd3 100644 --- a/files/update_puppet_code.timer +++ b/files/update_puppet_code.timer @@ -2,8 +2,8 @@ Description=Filter mail [Timer] -OnBootSec=5min -OnUnitActiveSec=5min +OnBootSec=10min +OnUnitActiveSec=10min Unit=update_puppet_code.service [Install] diff --git a/tasks/configure.yml b/tasks/configure.yml index d87c103..30ef1c6 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -123,4 +123,25 @@ file: path: /etc/puppetlabs/code/environments/production src: /etc/puppetlabs/code/environments/master - state: link \ No newline at end of file + state: link + +- name: Ensure service unit to update puppet code exists + template: + src: templates/update_puppet_code.service.j2 + dest: /etc/systemd/system/update_puppet_code.service + mode: 0644 + backup: yes + notify: Reload Systemd daemon + +- name: Ensure timer unit to update puppet code exists + copy: + src: files/update_puppet_code.timer + dest: /etc/systemd/system/update_puppet_code.timer + mode: 0644 + backup: yes + notify: Reload Systemd daemon + +- name: Ensure service to update puppet code is enabled + service: + name: update_puppet_code + enabled: true diff --git a/templates/update_puppet_code.service.j2 b/templates/update_puppet_code.service.j2 index 329113a..355e834 100644 --- a/templates/update_puppet_code.service.j2 +++ b/templates/update_puppet_code.service.j2 @@ -1,7 +1,6 @@ [Service] Type=oneshot -WorkingDirectory=/etc/puppetlabs/code/environments/production -ExecStart=git pull +ExecStart=r10k deploy environment -p --config /etc/puppetlabs/r10k/r10k.yaml [Unit] OnFailure=status_email_antoniodelgado@%n.service \ No newline at end of file