# PowerShell module for Ansible Tower underway

**URL:** <https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [October 2, 2014, 9:33pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410 "2014-10-02T21:33:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [October 2, 2014, 9:33pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/1 "2014-10-02T21:33:27Z")

</div>

Hi all,  
This is strictly not related to this group, but I wanted to share anyway:  
I’ve started development on a PowerShell module for interacting with Tower’s REST api. The Ansible team has done an amazing job of creating a very self-documenting api, so it shouldn’t take to long to have the most important functionality in place.

The current version only supports getting and creating organizations, but it’s set up in a way that lets me quickly add more stuff.

I’ll be looking for testers (and PR’s) down the road, but plan to do a little bit more development on it before I let more people in. If you want to keep track of progress, it’s published at:  
[https://github.com/trondhindenes/AnsibleTower-PowerShell](https://github.com/trondhindenes/AnsibleTower-PowerShell)

Mind you, you’ll need visual studio to combile the project as it sits right now (just build the included project in-place and then run import-module AnsibleTower.psd1).  
I’m also running on basic authentication, plan to switch to token-based auth in the near future.

So, if you’re using Tower and are doing any Windows development so you happen to have Visual Studio on your machine, let me know if you want to help test/contribute!

Regards,  
Trond

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 2, 2014, 10:16pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/2 "2014-10-02T22:16:52Z")

</div>

Offhand, I should mention some feedback I gave to Trond, namely:

(A) it’s nice to see this,  
(B) for most people it’s going to be totally weird

To use ansible a user does need a _Linux_ system, but might not have a Windows system.

As such, Python is the most obvious way to do this here.

A project to do this (open source is at): [https://github.com/ansible/tower-cli](https://github.com/ansible/tower-cli) and has useful python libraries that can be used by (if so desired) regular Ansible python modules.

So it’s understandable if you need something if you don’t know Python but IMHO in Ansible land, modules should only be powershell when they deal with managing Windows hosts.

In this case, it’s a bit of a weird thing.

Not saying it’s not valid, but if we’re going to include Tower CLI modules in core, they will be Python.

We may release some tower python modules in the future, but until now, most folks have been able to rely on the CLI.

James Martin wrote an example python application that uses the CLI’s libs here:

[https://github.com/jsmartin/tower\_populator](https://github.com/jsmartin/tower_populator)

That could be used as a possible starting point reference

Anyhow, all good that this exists - just wanted to make sure nobody left confused as to why Powershell 🙂

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [October 2, 2014, 10:36pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/3 "2014-10-02T22:36:17Z")

</div>

I completely agree.

I guess the “target group” of any are “mostly windows” shops who use/want to use Ansible Tower, but want to do their automation using .Net/Powershell. I’m guessing that’s a pretty small bunch right now, but who knows? At least this will enable me to demo Ansible for Windows people a bit easier.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 2, 2014, 11:01pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/4 "2014-10-02T23:01:29Z")

</div>

yep yep, all good!

---

<div class="post-metadata">

**Author:** ![Dmitry\_Karanfilov](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@Dmitry\_Karanfilov](https://forum.ansible.com/u/Dmitry_Karanfilov)\
**Post date:** [February 10, 2015, 2:50pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/5 "2015-02-10T14:50:25Z")

</div>

Trond, just want to thank you for your work and it is pity that you are stopped the work on this module.  
This module definitely has the right to life.

Our project hosts in Azure, and we have ~ 50/50 Windows and Linux servers.  
For Windows we are using PowerShell DSC.  
For Azure we are using PowerShell.  
For Linux we are using Ansible end Ansible Tower.

All deployments are managed from Release Management Server, and we have to use [SSH-PowerShel](http://www.powershelladmin.com/wiki/SSH_from_PowerShell_using_the_SSH.NET_library)l module for connecting to the Ansible Tower box and then invoking the tower-cli for launching Job-Templates.  
So it would be much easier to launch Job-Templates directly from PowerShell instead of connecting by SSH and then use tower-cli.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [February 10, 2015, 2:54pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/6 "2015-02-10T14:54:20Z")

</div>

Hi,  
Thanks, it was fun figuring out the API, super-easy really.

The module is not as done as I’d like to be, but as it stands you should be able to fire off job templates. Let me know if you need some pointers and I’d be happy to provide them here, or (even better) bake them into the PS module. Nothing would please me more than have people actually use it. It’s a pretty slick module IMHO 🙂

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 10, 2015, 2:59pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/7 "2015-02-10T14:59:20Z")

</div>

you don't need to ssh into tower to run jobs, you can setup the  
callback mechanism and just invoke through a web call.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [February 10, 2015, 3:04pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/8 "2015-02-10T15:04:06Z")

</div>

So I quckly pushed an update to the repo with some in-fuction help Look at line 53 in [https://github.com/trondhindenes/AnsibleTower-PowerShell/blob/master/AnsibleJobTemplate.ps1](https://github.com/trondhindenes/AnsibleTower-PowerShell/blob/master/AnsibleJobTemplate.ps1) for a basic example of how to invoke a job with the module.

---

<div class="post-metadata">

**Author:** ![Dmitry\_Karanfilov](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@Dmitry\_Karanfilov](https://forum.ansible.com/u/Dmitry_Karanfilov)\
**Post date:** [February 11, 2015, 12:40pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/9 "2015-02-11T12:40:54Z")

</div>

Thank you Trond! I have tried and it works for me.  
Brian, thanks for pointing to the callback mechanism, it’s really nice feature, but is it not always could be used.  
In my case I need to perform a job on multiple hosts which is related to each other and I need to be sure that all of them (hosts) already available (in the same time) before launch a job.  
So I don’t realize how to do it with callback mechanism.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [February 11, 2015, 12:46pm UTC](https://forum.ansible.com/t/powershell-module-for-ansible-tower-underway/16410/10 "2015-02-11T12:46:49Z")

</div>

Glad to hear it!

I’ll try and update the module with some more help examples.
