On 23.03.2018 07:10, GURU W wrote:
Hi All,
I know ansible is for configuration management, provisioning, task
automation. Ansible is already use to solve the purpose.
*Background:* I have shell scripts to read a filename from source and
copying them to declared target location.
*Ex:* "xyz_date_123.txt" (script does the task of reading the date in
the
filename and creates target directory aswel, later places the file
inside
destination say: Project/YYYY/MM/DD directory)
I was wondering if we could do this using ansible, I have "functions",
"if", "else" statements. Wasn't sure if we could use ansible to solve
this
purpose.
Expert advice would be most appreciated.
It's doable.
find module to find the file, .split [1] on the filename to get the date
out and then some slicing of the result to get the year, month and day.
Then it's just using fetch and/or copy module depending where the file
should be copied to.
[1] https://docs.python.org/2/library/stdtypes.html#str.split
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/b8e4dca469d47c35480db73267065f73%40olstad.com.
For more options, visit https://groups.google.com/d/optout.