pve_tests/ansible/task-number-playbook.yaml

32 lines
754 B
YAML

---
- name: Save global variables
hosts: all_vms
vars_prompt:
- name: task_number
private: false
- name: branch
private: false
- name: k8s_version
private: false
tasks:
- name: Add dummy host to save global vars
run_once: true
add_host:
name: DUMMY_GLOBAL_VARS
task_number: "{{ task_number }}"
branch: "{{ branch }}"
k8s_version: "{{ k8s_version }}"
- name: Maybe install apt-repo
hosts: all_vms
tasks:
- name: Install apt-repo
apt_rpm:
name: apt-repo
update_cache: true
when: hostvars.DUMMY_GLOBAL_VARS.task_number
- name: Add task
apt_repo:
repo: "{{ hostvars.DUMMY_GLOBAL_VARS.task_number }}"
when: hostvars.DUMMY_GLOBAL_VARS.task_number