且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ansible:读取远程文件

更新时间:2023-01-15 17:57:38

EDIT :提出此问题时,可以接受以下解决方案.更高版本的Ansible可能会提供更好的解决方案来解决此问题.因此,如果您不赞成投票,请检查此问题的发布时间.

EDIT: When this question was asked, the following solution was acceptable. Later versions of Ansible may provide a better solution to solve this problem. So if you are downvoting, check when this question was posted.

正如您所说,所有查找都在本地主机上.但是所有这些都可以通过使用 shell register 在远程完成.你能说出你到底想做什么吗?只是一个例子.

As you said, all lookups are on localhost. But all of them can be done on remote by using shell and register. Can you tell what exactly you are trying to do? just an example.

  - shell: cat "{{remote_file}}"
    register: data

  - shell: ......
    with_xxxx: