61 lines
1.5 KiB
YAML
61 lines
1.5 KiB
YAML
---
|
|
- name: Test ansible-hpa-playbook
|
|
hosts: all
|
|
roles:
|
|
- role: setup-project
|
|
tags:
|
|
- setup-project
|
|
- never # force passing tags to run.
|
|
vars:
|
|
template_dir:
|
|
path: "/tmp/hpa-playbook-tmp"
|
|
vars: "repo_vars"
|
|
project_dir: "/tmp/hpa-setup-project-tmp"
|
|
|
|
- role: repo-template
|
|
tags:
|
|
- repo-template
|
|
- never # force passing tags to run.
|
|
- role: build-project
|
|
tags:
|
|
- build-project
|
|
- never # force passing tags to run.
|
|
vars:
|
|
template_dir:
|
|
path: "/tmp/hpa-playbook-tmp"
|
|
vars: "repo_vars"
|
|
project_dir: "/tmp/hpa-setup-project-tmp"
|
|
|
|
tasks:
|
|
- name: Test complex var, set fact.
|
|
ansible.builtin.set_fact:
|
|
template_path: "{{ template.path | default('.build') }}"
|
|
vars:
|
|
template:
|
|
repo:
|
|
url: "https://example.com"
|
|
version: "main"
|
|
tags:
|
|
- vars
|
|
- never
|
|
|
|
- name: Test complex var, set fact when path is specified.
|
|
ansible.builtin.set_fact:
|
|
template_path_specified: true
|
|
vars:
|
|
template:
|
|
repo:
|
|
url: "https://example.com"
|
|
version: "main"
|
|
when: template.path is defined
|
|
tags:
|
|
- vars
|
|
- never
|
|
|
|
- name: Test complex var was set.
|
|
ansible.builtin.debug:
|
|
msg: "Template path: {{ template_path }}, specified: {{ template_path_specified | default(false) }}"
|
|
tags:
|
|
- vars
|
|
- never
|