【问题标题】:Looking for ansible solution to read standalone.xml files on wildfly寻找在 wildfly 上读取standalone.xml 文件的 ansible 解决方案
【发布时间】:2019-06-05 20:21:26
【问题描述】:

寻找一种解决方案,从我的 hosts 文件中按“暂存”或“生产”分组的各种 Wildfly 服务器收集和组织standalone.xml 文件。

查看是否有与以下相同输出功能可用的东西:

ansible wildfly -m setup --tree config

为每个主机创建一个包含请求数据的文件。

例如,如果我有 4 台服务器,每台服务器都有一个名称完全相同的文件,在相同的路径中,但内容不同。我可以将它们复制到本地目录并以它来自的服务器命名:

(例如:

standalone.server1.myserver.com

standalone.server2.myserver.com

)

【问题讨论】:

    标签: ansible wildfly centos7


    【解决方案1】:

    您可以使用fetch 模块,例如作为临时命令:

    ansible wildfly -i myInventory -m fetch -a "src=/myRemotePathname/standalone dest=/myLocalPathName/myDir" -u myUser
    

    您将从属于在myInventory 文件中定义的wildfly 组的任何主机的远程目录/myRemotePathname 获取远程文件standalone 文件。 本地文件存储在本地/myLocalPathName/myDir 目录中,该目录有一个名为远程主机的子目录,位于远程目录路径下。

    【讨论】:

      【解决方案2】:

      使用 Ansible fetch 模块,其中有几个示例:

      一个非常简单的剧本可能看起来像:

      hosts: widlfy
      tasks:
        - name: Store file into /tmp/fetched/{hostname}/tmp/somefile
          fetch:
            src: /tmp/somefile
            dest: /tmp/fetched    
      

      运行剧本:
      ansible-playbook playbook.yml

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-07-20
        • 2017-07-27
        • 2017-08-11
        • 2019-01-16
        • 1970-01-01
        • 1970-01-01
        • 2012-09-05
        • 2022-10-24
        相关资源
        最近更新 更多