我有一个powershell脚本,它接受多个用户输入的文件,例如- "C:\temp\foo.ps1",然后它就会运行。我正在尝试使用win_shell模块将该脚本与Ansible集成。如何传递powershell脚本的用户输入:- - name: windows test command
win_shell: C:\temp\Snapshots.ps1
args:
stdin: C:\temp\test3.csv 脚本(Powershell):- $CONumber = Read-Host "Enter the CO Number
我正在尝试设置一个Ansible剧本,它将在Windows上运行一个PowerShell脚本,并在其上set_fact结果,并使用setup返回所有事实。
这是我的playbook.yml
---
- hosts: windows
gather_facts: no
tasks:
- name: Get a PowerShell script to work
script: files/gather-windows-facts.ps1
register: ps1_script
- debug: var=ps1_script
- name
我已经在windows上使用PowerShell中的Choco安装了Python。它起作用了。
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
我还从pip安装了ansible。
ansible==2.3.0.0
但是当我
我无法在使用Ansible的Get-ADDomain脚本中使用Active Directory命令,如Get-ADDomain、Get-ADUser等。像ls、New-Item这样的基本命令工作得很好。
环境
ad-dns.test.com - Windows 2012 AD and DNS Server
box88.test.com - CentOS 7.2 (Not joined to domain) : Ansible, Kerberos, Python
box62.test.com - Windows 2012 R2 Standard (Joined to do
我有一个游戏手册,它首先在vSphere集群上创建一个虚拟机。它使用hosts: localhost,因此API由ansible调用。VM的创建工作正常。在VM创建和运行之后,我想在创建的VM上调用一个powershell脚本。
在这一点上,我遇到了以下问题:
{
"unreachable": true,
"msg": "Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permi
我能够编写一个Powershell 2.0脚本来停止某些运行中的服务,这是我在Ansible脚本中使用的。Ansible脚本首先重新启动VM,然后运行脚本。
# Get a list of running XYZ_* services and store them in an array.
$runningExaServices = Get-Service | Where-Object {$_.Name -like "*XYZ_*"} | Where-Object {$_.Status -eq "Running"}
# Iterate throgh the s
我试图通过Ansible部署vSphere Windows,并需要设置特定的屏幕分辨率(1024x768)。使用以下命令在本地运行VMWareResolutionSet.exe在PowerShell中工作(需要用in Powershell to avoid making the arguments a list, and the来转义, &`用于运行路径中有空格的命令):
& "C:\Program Files\VMWare\VMware Tools\VMwareResolutionSet.exe" 0 1 `, 0 0 1024 768
但是,使用Ansibl