role_drone_runner_exec/tasks/configuration.yml

70 lines
2.0 KiB
YAML
Raw Permalink Normal View History

2022-10-17 11:06:34 +00:00
---
# tasks file for drone_runner_exec
- name: Créer le dossier de configuration
ansible.builtin.file:
state: directory
path: "{{ drone_runner_exec_config_base_path }}"
owner: "{{ drone_runner_exec_user }}"
group: "{{ drone_runner_exec_user }}"
mode: u=rwX,g=rX,o=rX
become: true
- name: Créer le dossier de journalisation
ansible.builtin.file:
state: directory
path: /var/log/drone-runner-exec
owner: "{{ drone_runner_exec_user }}"
group: "{{ drone_runner_exec_user }}"
mode: u=rwX,g=rX,o=rX
become: true
- name: Configurer le runner
ansible.builtin.template:
src: config.j2
dest: "{{ drone_runner_exec_config_base_path }}/config"
owner: "{{ drone_runner_exec_user }}"
group: "{{ drone_runner_exec_user }}"
mode: u=rwX,g=rX,o=rX
become: true
notify: Redémarrer drone-runner-exec.service
- name: Récupérer les faits sur les services
ansible.builtin.service_facts:
- name: Installer drone-runner.service
ansible.builtin.command:
cmd: >-
/opt/drone-runner-exec/drone-runner-exec service install
--config="{{ drone_runner_exec_config_base_path }}/config"
when: "'drone-runner-exec.service' not in ansible_facts.services"
become: true
notify: Redémarrer drone-runner-exec.service
- name: Créer le dossier de surcharge du service
ansible.builtin.file:
state: directory
path: /etc/systemd/system/drone-runner-exec.service.d
mode: u=rwX,g=rX,o=rX
become: true
- name: Définir l'utilisateur du service
ansible.builtin.template:
src: override.conf.j2
dest: /etc/systemd/system/drone-runner-exec.service.d/override.conf
owner: root
group: root
mode: u=rwX,g=rX,o=rX
become: true
notify: Redémarrer drone-runner-exec.service
- name: Déployer le script permettant d'exécuter un pipeline depuis une autre
ansible.builtin.copy:
src: drone-downstream.bash
dest: /opt/drone-runner-exec/drone-downstream.bash
owner: root
group: root
mode: u=rwx,g=rx,o=rx
become: true
diff: false