Need your advice my playbook for Ansible project for CISCO ACI to automate getting for store logs and records execution time

14 views
Skip to first unread message

Richard Lazaro

unread,
Feb 21, 2022, 12:18:20 PM2/21/22
to Ansible Project

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

Reply all
Reply to author
Forward
0 new messages