25 lines
1.0 KiB
YAML
25 lines
1.0 KiB
YAML
---
|
|
- hosts: localhost
|
|
roles:
|
|
- add-bastion-host
|
|
|
|
- hosts: prod_bastion[0]
|
|
tasks:
|
|
- name: Run the production playbook and capture logs
|
|
block:
|
|
- name: Get a current timestamp
|
|
ansible.builtin.set_fact:
|
|
_log_timestamp: "{{ lookup('pipe', 'date +%Y-%m-%dT%H:%M:%S') }}"
|
|
|
|
- name: Construct execution command
|
|
ansible.builtin.set_fact:
|
|
ansible_command: "ansible-playbook -v -f {{ infra_prod_ansible_forks }} /home/zuul/src/github.com/opentelekomcloud-infra/system-config/playbooks/{{ playbook_name }} -e '{{ ((extra_job_vars | default({}))) | to_json }}'"
|
|
|
|
- name: Log a playbook start header
|
|
become: true
|
|
ansible.builtin.shell: 'echo "Running {{ _log_timestamp }}: {{ ansible_command }}" > /var/log/ansible/{{ playbook_name }}.log'
|
|
|
|
- name: Run specified playbook on bridge and redirect output
|
|
become: true
|
|
ansible.builtin.shell: "{{ ansible_command }} >> /var/log/ansible/{{ playbook_name }}.log"
|