--- - name: EPICS setup become: true vars: service_name: epics_setup block: - name: Create systemd service file ansible.builtin.copy: dest: /etc/systemd/system/{{ service_name }}.service content: | [Unit] Description=Update epics_contexts.yml and gfa_12_epics.sh from gfa-global-profile [Service] Type=oneshot ExecStart=/usr/bin/curl -o /etc/epics_contexts.yml https://git.psi.ch/gfa_rpms/gfa-global-profile/-/raw/master/src/etc/epics_contexts.yml ExecStart=/usr/bin/curl -o /etc/profile.d/gfa_12_epics.sh https://git.psi.ch/gfa_rpms/gfa-global-profile/-/raw/master/src/etc/profile.d/gfa_12_epics.sh User=root - name: Trigger epics_setup service ansible.builtin.systemd_service: name: "{{ service_name }}.service" state: started daemon_reload: true when: not ansible_check_mode - name: Create systemd timer file ansible.builtin.copy: dest: /etc/systemd/system/{{ service_name }}.timer content: | [Unit] Description=Timer to update epics_contexts.yml and gfa_12_epics.sh from gfa-global-profile [Timer] OnCalendar=daily Persistent=true [Install] WantedBy=timers.target - name: Enable and start systemd timer ansible.builtin.systemd_service: name: "{{ service_name }}.timer" enabled: yes state: started daemon_reload: true when: not ansible_check_mode