---- hosts: server01 remote_user: jlouthan vars: proddbhost: proddb01 tasks: - name: Get current timestamp local_action: command bash -c 'date +%Y-%m-%d.%H%M' register: timestamp run_once: true
- name: Get current datestamp local_action: command bash -c 'date +%Y-%m-%d' register: datestamp run_once: true - include: playbook-01.yml---
- hosts: "{{ proddbhost }}"---- hosts: server01 remote_user: jlouthan vars: proddbhost: proddb01 tasks: - name: Get current timestamp local_action: command bash -c 'date +%Y-%m-%d.%H%M' register: timestamp run_once: true
- name: Get current datestamp local_action: command bash -c 'date +%Y-%m-%d' register: datestamp run_once: true - include: playbook-01.yml
---- hosts: "{{ hostvars['server01']['proddbhost'] }}"