I'm trying to create a directory on a network drive using ansible (version 2.9). I made a powershell script which I've copied to the server and I'm calling via win_command
.
我正在尝试使用Ansible(2.9版)在网络驱动器上创建一个目录。我制作了一个PowerShell脚本,并将其复制到服务器上,然后通过Win_Command调用它。
New-Item -ItemType Directory -Force -Path \\\\server\path\a\b
When I run the script on a Windows server, it correctly creates the directory at \\server\path\a\b
, however, when I run it via ansible, it creates a directory at C:\server\path\a\b
.
当我在Windows服务器上运行该脚本时,它正确地在\\SERVER\PATH\a\b处创建了目录,但是,当我通过Anable运行它时,它在C:\SERVER\PATH\a\b处创建了一个目录。
- name: Run create dir script
win_command: 'powershell C:\Temp\script.ps1'
become: yes
vars:
ansible_become_user: "network_user"
ansible_become_pass: "network_password"
ansible_become_method: runas
ansible_become_flags: logon_type=new_credentials logon_flags=netcredentials_only
How do I get it to not create the directory in the C:\
drive?
如何使其不在C:\驱动器中创建目录?
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!