Deploying Windows Server using Ansible Tower

371 views
Skip to first unread message

Nicholas Branson

unread,
Jul 29, 2022, 6:31:11 AM7/29/22
to Ansible Project
Ansible Newbie Calling...

We have Ansible Tower and Satellite. 

I've been asked to look at Deploying Windows Server using Ansible Tower.

I've created a win2019-tmp (template) in VMware

Now I need to look at creating a Role playbook to deploy a Windows system in VMware.

I've made a start on the main.yml and vars.yml files but I am not sure they will run on my new pipeline yet. 

Is there a way to check if the pipeline is ready to test playbooks on ?

Also, since I will be deploying a Windows Server that has not been created yet, how can I put any info in the Ansible Tower Template Inventory area if it does not exist?  

I hope someone can help me with Windows deployements using Ansible. I couldn't find a suitable Red Hat course for this.

Thanks
Nick



Wei-Yen Tan

unread,
Jul 29, 2022, 1:18:16 PM7/29/22
to ansible...@googlegroups.com
You can use add_host to the playbook that generates In memory hosts during the execution run 

From: 'Nicholas Branson' via Ansible Project <ansible...@googlegroups.com>
Sent: Friday, July 29, 2022 10:31:11 PM
To: Ansible Project <ansible...@googlegroups.com>
Subject: [ansible-project] Deploying Windows Server using Ansible Tower
 

DISCLAIMER

This email is confidential and subject to important disclaimers and conditions in relation to monitoring, viruses, confidentiality and legal privilege full details of which can be viewed on our Email Policy at the following link: http://www.next.co.uk/Policy/

Next Holdings Ltd registered in England 35161.  Registered Office Desford Road Enderby Leicester LE19 4AT.  Authorised and regulated by the Financial Conduct Authority

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a54de861-ffef-4f15-bffa-46d472101ec2n%40googlegroups.com.

Evan Hisey

unread,
Jul 29, 2022, 3:28:03 PM7/29/22
to ansible...@googlegroups.com
Sounds like good use of Tower callback function. That way Tower does not have to know anything about the new host. Just be sure the windows image is configure for ansible, and then use either a cloud_init or or a first run script to execute the callback.

Walter Rowe

unread,
Aug 1, 2022, 7:30:28 AM8/1/22
to Ansible Project
You don't need the machine added to an inventory and you don't need ansible tower callbacks. The vmware_guest module doesn't require either one. You do need to know the name of the new machine in a variable.

We have a very elaborate ServiceNow -> Ansible Tower request and deliver workflow. We create the VMs (or EC2s in AWS), then create the DNS record, then do OS level machine customization.

Email be directly and I can set up a TEAMS call to show you our playbook for creating a machine in VMware.

ASP-Workflow-Concept.png

Walter Rowe

unread,
Aug 1, 2022, 7:43:24 AM8/1/22
to Ansible Project
The "secret" to any good provisioning workflow is to parameterize EVERYTHING. We feed user specifications from a ServiceNow request into our Ansible Tower workflow. These specifications include what network, what AD OU to deposit the new computer object we create, what function the server will provide, what OS and version (windows 2016, windows 2019, ubuntu 20, ubuntu22, redhat8, rocky8, debian10, debian11, etc), AWS or VMware, etc. Our playbooks in ansible tower use most of these parameters from the ServiceNow request as keys into dictionaries or as indicators of specific vars files to import that have detailed specifications in YAML format we can use to do all our work for provisioning. We can add new operating system versions, new cloud service providers, new machine purposes and describe all of these in our vars files and parameters from ServiceNow. We have to make few if any changes to the actual playbooks. Even attached storage is described in a JSON list that cleverly has all the disks associated with each machine type for both Windows and Linux. A json_query lets us pull out the records we need from the JSON list.
--
Walter Rowe, Chief
Infrastructure Services

Office of Information Systems Mgmt
National Institute of Standards and Technology
US Department of Commerce

Walter Rowe

unread,
Aug 1, 2022, 7:58:49 AM8/1/22
to Ansible Project
One more item I will add .. in our Customize step of our workflow we do create an in-memory inventory with the new machine name so the steps in that lengthy process have an inventory to work on.


--
Walter Rowe, Chief
Infrastructure Services

Office of Information Systems Mgmt
National Institute of Standards and Technology
US Department of Commerce

Wei-Yen Tan

unread,
Aug 1, 2022, 8:05:01 AM8/1/22
to ansible...@googlegroups.com
It's that the add_host directive? 

From: 'Walter Rowe' via Ansible Project <ansible...@googlegroups.com>
Sent: Monday, August 1, 2022 11:58:48 PM
To: Ansible Project <ansible...@googlegroups.com>
Subject: Re: [ansible-project] Deploying Windows Server using Ansible Tower
 

Walter Rowe

unread,
Aug 1, 2022, 8:25:30 AM8/1/22
to Ansible Project
Yes. We use TWO plays in a playbook. The first play uses an extra_var of the hostname to create a new host group. The second play scopes its inventory to that host group.

In our workflow the new machines' name comes in as an extra var called vm_guest_name.

##
## play 1: add new machine to inventory
##
- name: Add new host to playbook inventory
  hosts: localhost
  gather_facts: no
  tasks:

    # add our new host to the inventory for this play
    - name: add {{ vm_guest_name | lower }}
      add_host:
        name: "{{ vm_guest_name | lower }}"
        group: newvm

##
## play 2: customize new machine
##
- name: "Customize Server - Linux - Set Time Zone, Hostname, Join AD"
  gather_facts: no
  hosts: newvm
  become: yes

--
Walter Rowe, Chief
Infrastructure Services
Office of Information Systems Management
National Institute of Standards and Technology
United States Department of Commerce

Wei-Yen Tan

unread,
Aug 1, 2022, 8:31:07 AM8/1/22
to ansible...@googlegroups.com
Ahh yes. So as I suggested. You are using what I suggested to the op before 

From: 'Walter Rowe' via Ansible Project <ansible...@googlegroups.com>
Sent: Tuesday, August 2, 2022 12:25:30 AM

Walter Rowe

unread,
Aug 1, 2022, 8:43:22 AM8/1/22
to Ansible Project
No. It is not used for creating the machine (vmware_guest module). It is only used for customizing the machine AFTER it is created. In the graphic I provided we do this only for the Customize step in the workflow. In the 'Create Machine' step in the workflow we DO NOT do this. It isn't necessary.
--
Walter Rowe, Chief
Infrastructure Services
Office of Information Systems Management
National Institute of Standards and Technology
United States Department of Commerce

Dineshbabu Shankar

unread,
Sep 5, 2022, 10:52:48 PM9/5/22
to ansible...@googlegroups.com
Hello folks,
I am trying to setup the servicenow and ansible awx integration can any one help me.

I have developers snow instance and awx installed on the machine .


Reply all
Reply to author
Forward
0 new messages