我可以使用win_copy模块通过网络递归地将安装程序从控制器机器复制到Windows机器吗?
任务是复制安装程序并使用Ansible在整个环境中的所有Windows服务器中安装它
win_copy: Linux machine to windows machine
src: /opt/installer/win/xx.ex
dest: C:\ansible
remote_src: yes
复制后,在所有win服务器上安装可执行文件?我在这里使用正确的方法/技术吗?
你的例子中有错误。
Arg:remote_src: yes
- 如果是,它将转到src的远程/目标机器。
结果:您将xx.ex从Windows复制到Windows,但在Windows文件系统上没有路径/opt/installer/win/xx.ex
如果我们正在谈论通过ansible将文件从Windows移动到不同服务器上的另一个窗口,那么很可能没有。如果您需要从ansible-server(* nix)传输文件到windows,只需使用win_copy而不使用remote_src: yes
- name: start of the windows update
hosts: win
serial: 1
connection: winrm
become_method: runas
become_user: sena
vars:
ansible_become_password: "*!,W:t?5qc%{~9/"
file_name : "WindowsSensor_392D4CEC720244B9B1D5434A7AC78AA3-70.exe"
repo_unix_path : "/home/ansible/"
win_path : "C:\\Ansible_Installer\\"
- name: Copy installer from Linux to windows
win_copy:
src: "{{repo_unix_path}}{{file_name}}"
dest: "{{win_path}}"
- name:
win_package:
path: "{{win_path}}{{file_name}}"
productid: auto
creates_service: "CSFalconService" #if available doesn`t install
arguments: /install /passive /norestart