0

I have some PowerShell commands to perform a job. Instead of running them one after another, I want to place them in an Ansible playbook so that they get executed in a sequence when the playbook is being run.

Any suggestions about which modules could I use in ansible to do this??

2
  • Is Ansible's documentation of any help? docs.ansible.com/ansible/… Commented Oct 25, 2016 at 14:38
  • Yaaa...it is a good help Commented Oct 25, 2016 at 15:10

1 Answer 1

3

Save the commands to a file and execute them using the script module.

- script: PowerShell.ps1
Sign up to request clarification or add additional context in comments.

3 Comments

Hey, I have done this.... - script: 'C:\Users\Administrator\Desktop\cpsm' where cpsm is the name of the powershell file. But, I get the error that it is unable to find the file in the expected paths.
Did you read and understand this sentence from the manual "The local script at path will be transferred to the remote node and then executed"?
I am so sorry....Its my mistake...I solved it finally by placing the ps1 file in my linux controller machine. Thanxxx Techraf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.