Groups
Sign in
Groups
Ansible Project
Conversations
About
Send feedback
Help
how to exclude directories when I use ansible fetch
11 views
Skip to first unread message
federico montaldo
unread,
Jun 13, 2019, 5:10:48 PM
6/13/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
HI folks:
I need to extract two files for a windows servers. I made the following playbook:
---
- hosts: 10.33.81.12
vars:
dir_src: "C:/Websites/
citihabitats.com/
"
dir_dest: /tmp/fetched/
tasks:
- name: fetch nginx access and error log
fetch:
src: "{{ dir_src }}/{{ item}}.config"
dest: "{{ dir_dest }}"
register: fetch_output
loop:
- appsettings.beta
- Web
It works but I want to know if there is a way to exclude the full path of the windows dir. This is the output there I got ins the dir for the ansible controller.
[svc-devops@wnrt2-cg-lmon2 ansible]$ tree /tmp/fetched/
10.33.81.12/
/tmp/fetched/
10.33.81.12/
└── C:
└── Websites
└──
citihabitats.com
├── appsettings.beta.config
└── Web.config
3 directories, 2 files
There is a way to only have a destination dir like:
/tmp/fetched/IP/
Thanks in advance
Regards
Dick Visser
unread,
Jun 13, 2019, 7:33:54 PM
6/13/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Try:
--
- hosts: 10.33.81.12
vars:
dir_src: "C:/Websites/
citihabitats.com/
"
dir_dest: /tmp/fetched/
tasks:
- name: fetch nginx access and error log
fetch:
src: "{{ dir_src }}/{{ item}}.config"
dest: "{{ dir_dest }}/{{ inventory_hostname }}/"
flat: yes
register: fetch_output
loop:
- appsettings.beta
- Web
> --
> 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
ansible-proje...@googlegroups.com
.
> To post to this group, send email to
ansible...@googlegroups.com
.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e017138f-7f90-4d3d-ae53-3a4e202478e0%40googlegroups.com
.
> For more options, visit
https://groups.google.com/d/optout
.
--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
federico montaldo
unread,
Jun 14, 2019, 9:03:53 AM
6/14/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
HI Dick,
Thanks for your help. It works!!!!.
Regards
> To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNvfFn-S9g_ReL0PqpMeyfG%2BC6EgWWF6VZrNwjqq%2B_trw%40mail.gmail.com
.
Reply all
Reply to author
Forward
0 new messages