Something like this ? (directly copied from a play I use... not tweaked to
your settings ;) )


#!/usr/bin/env ansible-playbook
# Fetch files from remote hosts

---

- hosts: all
  gather_facts: yes
  vars:
    outputdir: "data"
    infofiles:
      - /etc/krb5.conf
      - /etc/resolv.conf
      - /etc/sysconfig/network-scripts/ifcfg-*
      - /etc/sysconfig/network-scripts/route-*
      - /etc/sudoers.d/*
  become: yes
  tasks:

  - name: Fetch filenames
    shell: "find {{infofiles|join(' ')}} -type f"
    register: filenames
    ignore_errors: yes
    tags:
      - filenames
      - fetch

  - name: Fetch config-files
    fetch: src="{{item}}" dest="{{outputdir}}/"
    with_items:
      - /etc/passwd
      - /etc/redhat-release
      - "{{filenames.stdout_lines}}"
    tags:
      - fetch


On Fri, Jul 8, 2016 at 1:55 PM, alex podolin <[email protected]> wrote:

> Hi all. I hope anybody can help me.
> I have a few servers called SERVER-01 SERVER-02....SERVER-N
> and *.conf files for this servers
> # tree roles/put_cameras/files/nginx/
> roles/put_cameras/files/nginx/
> ├──SERVER-01
> │   ├── config01.conf
> │   ├── config02.conf
>
> ├── SERVER-02
> │   ├── config01.conf
> │   ├── config02.conf
> .......
> ├── SERVER-N
> │   ├── config01.conf
> │   ├── config02.conf
>
> can you tell me, how to put files from  files/nginx/SERVER-01/{*.conf} to
> SERVER-01 /etc/nginx; files/nginx/SERVER-02/{*.conf} to SERVER-02
> /etc/nginx; files/nginx/SERVER-N/{*.conf} to SERVER-N /etc/nginx;
> I think i can do it throw loops? but i don't understand how...
>
>
>
>
> --
> 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/860d76f6-59b4-43b9-9a32-d74fde8b0f3f%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/860d76f6-59b4-43b9-9a32-d74fde8b0f3f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Mark Janssen  --  maniac(at)maniac.nl
Unix / Linux Open-Source and Internet Consultant
Maniac.nl Sig-IO.nl Vps.Stoned-IT.com

-- 
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/CAKs9mshF2khoCUMgC-%2BBPXin%2BWLisD3sMPvRRagmi5fRuNO4jg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to