Hi ,
Just letting you check if my plabook is correct below:
I just need your help on our project to Ansible for Cisco ACI module to:
(1) Create variables to record execution time
(2) Define as the variable the name of the directory where the log is stored.
(3)Create a directory on Ansible server to storel logs
---
-hosts: all #(1) Create variables to record execution time
gather_facts: false
task:
-name: create time
set_fact:
exe_date: “{{ lookup(‘pipe’,’date+%Y%m%d_%H%M_%S’) }}”
run_once: true
-name: create parent directory
set_fact:
logdir_date: “{{ inventory_dir }}/log/log_{{ exe_date }}”
run_once: true
-name: create directory for log
file:
path: “{{ logdir_date }}/”
state: directory
register: logdir
delegate_to: localhost
run_once: true
INVENTORY FILE look like this
[***]$ tree
-ansible.cfg
-doci_inventry.ini
-doci_logget.yml
-roles
-get_cli_command
-task:
-main.yml.
-save_cli_command
-task:
-main.yml
-get_aci_module
-task:
-main.yml
-save_aci_module
-task
-main.yml
-files
-g1_cli.txt