V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
fsckzy
V2EX  ›  Linux

ansible fetch 模块是否支持通配符?

  •  
  •   fsckzy · Jan 16, 2018 · 5870 views
    This topic created in 3036 days ago, the information mentioned may be changed or developed.

    有 300 多台服务器,每台 /tmp/log/目录下都有个文件,名字为 本机 ip.txt 如 192.168.1.1.txt 、192.168.1.2.txt ... 如何批量下载回本机?

    以下亲测无效

    ansible all -m fetch -a "src=/tmp/log/* dest=/tmp/"

    5 replies    2018-01-17 09:54:38 +08:00
    tusj
        1
    tusj  
       Jan 16, 2018
    单引号试试
    双引号的话本地 shell 会展开里面的东西
    jejer
        2
    jejer  
       Jan 16, 2018
    用 rsync 吧
    hljjhb
        3
    hljjhb  
       Jan 16, 2018
    hljjhb
        4
    hljjhb  
       Jan 16, 2018
    突然反应过来是问如何解决 - -

    ansible all -m synchronize -a "src=/tmp/log dest=/tmp/{{inventory_hostname}}/ mode=pull"
    fsckzy
        5
    fsckzy  
    OP
       Jan 17, 2018
    @hljjhb 谢谢你
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2988 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 08:39 · PVG 16:39 · LAX 01:39 · JFK 04:39
    ♥ Do have faith in what you're doing.