Add new playbook launch_role.yml.

This commit is contained in:
yohan 2024-10-19 12:12:10 +02:00
parent 25527b71ba
commit aad97af73a

33
launch_role.yml Normal file
View File

@ -0,0 +1,33 @@
- name: Create temp inventory
hosts: localhost
gather_facts: false
tasks:
- name: add target to temp inventory
ansible.builtin.add_host:
name: "{{ target_name }}"
groups: target
changed_when: false
- name: Launch a role
hosts: target
vars_files:
- vars/main.yml
gather_facts: false
tasks:
- name: Set ansible_user
set_fact:
ansible_user: "{{ LINUX_USERNAME }}"
- name: Gather facts
ansible.builtin.setup:
- name: Include retrieve_secret_vars tasks
ansible.builtin.include_tasks:
file: "tasks/retrieve_secret_vars.yml"
- name: Include secrets from yml db
ansible.builtin.include_vars: "{{ local_workdir }}/secrets.yml"
- name: Include {{ role_name }}
ansible.builtin.include_role:
name: {{ role_name }}