46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
- name: 'Clone Python package Git repo ''{{ git.repo_url }}'''
|
|
ansible.builtin.git:
|
|
repo: '{{ git.repo_url }}'
|
|
dest: '{{ git.path }}/{{ git.branch }}'
|
|
|
|
|
|
|
|
- name: 'If Git repo has config: Add config'
|
|
when: 'git.config_file'
|
|
ansible.builtin.copy:
|
|
src: '{{ git.config_file }}'
|
|
dest: '/{{ git.config_file }}'
|
|
mode: '0644'
|
|
|
|
|
|
|
|
- name: 'If Git repo wants systemd: Copy systemd unit file'
|
|
when: '(git.systemd.service) and (git.systemd.timer)'
|
|
register: 'rv_copy_systemd_unit_files'
|
|
loop_control:
|
|
loop_var: 'unit'
|
|
label: '{{ unit.destination }}'
|
|
loop:
|
|
- { source: '{{ git.systemd.service }}', destination: '/{{ git.systemd.service }}', mode: '0644' }
|
|
- { source: '{{ git.systemd.timer }}', destination: '/{{ git.systemd.timer }}', mode: '0644' }
|
|
ansible.builtin.copy:
|
|
src: '{{ unit.source }}'
|
|
dest: '{{ unit.destination }}'
|
|
mode: '{{ unit.mode }}'
|
|
|
|
|
|
|
|
- name: 'If systemd copy changed: systemctl daemon-reload'
|
|
when: '(rv_copy_systemd_unit_files.changed)'
|
|
ansible.builtin.systemd:
|
|
daemon_reload: 'yes'
|
|
|
|
|
|
|
|
- name: 'If systemd copy succeeded: systemctl enable --now timer unit'
|
|
when: '(rv_copy_systemd_unit_files is success)'
|
|
ansible.builtin.systemd:
|
|
enabled: 'yes'
|
|
state: 'started'
|
|
name: '{{ git.systemd.timer | basename }}'
|