role_drone_cli/tasks/configuration.yml

29 lines
805 B
YAML
Raw Normal View History

2022-10-21 15:46:00 +00:00
---
# tasks file for drone_cli
- name: Récupérer les informations
ansible.builtin.command:
cmd: drone {{ item.type }} info {{ item.target }} {{ item.name }}
environment:
DRONE_SERVER: "{{ drone_cli_server_url }}"
DRONE_TOKEN: "{{ drone_cli_server_token }}"
register: info
changed_when: info.rc != 0
diff: false
- name: Déterminer qu'il faut mettre à jour
ansible.builtin.set_fact:
cmd_action: update
when:
- info.rc == 0
- item.type in cmd_updatable
- name: Exécuter les commandes
ansible.builtin.command:
cmd: drone {{ item.type }} {{ cmd_action }} {{ item.target }} {{ item.name }} {{ item.data }}
environment:
DRONE_SERVER: "{{ drone_cli_server_url }}"
DRONE_TOKEN: "{{ drone_cli_server_token }}"
changed_when: info.rc != 0
diff: false