Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

ansible tar with a datestamp

---
- hosts: localhost
  become: no
  gather_facts: yes

  tasks:
   - name: Display the available timestamp format in Ansible
     shell: cp /etc/nsswitch.conf  /etc/nsswitch.conf.{{ ansible_date_time.iso8601 }}

   - name: Display the newly created file
     shell: ls -lrt /etc/nsswitch.conf.{{ ansible_date_time.iso8601 }}
     register: LISTFILE

   - debug: msg={{ LISTFILE.stdout }}
Source by www.unixarena.com #
 
PREVIOUS NEXT
Tagged: #ansible #tar #datestamp
ADD COMMENT
Topic
Name
5+1 =