Greetings, IT Enthusiasts! Welcome to my blog, your go-to destination for all things. Whether you’re a seasoned developer, admin or a curious beginner, we’ve got something for everyone.
I’ll try to provide information and examples in a pill-like form, avoiding unnecessary complications at every level.
I assume that you have already installed ansible. If not, please check my blog.
We have a couple of things to do on both the ansible server site and the remote Windows machine.
Let’s start with Windows machine. With most version of Windows, Winrm ships in the box but not turned on by default.
There is a script you can run on the remote Windows machine in PowerShell console as an Administrator. Please download it from link below. Please “Set-ExecutionPolicy Bypass” before executing the script.
, I assume that you have already installed Tomcat, Tomcat System Service, and Ansible. If you have not, please check my blog for instructions.
First we need a inventory file. Let’s create /etc/ansible/hosts file copying foloowing lines. You need to use your tomcat sever ip and user information.
Let’s try a simple ansible playbook to test without creating inventory file. We will be using localhost.
create a test.yml file with below lines and save it.
- hosts: localhost
tasks:
- name: Get user name
shell: whoami
register: theuser
- name: Get host name
shell: hostname
register: thehost
- debug: msg="I am {{ theuser.stdout }} at {{ thehost.stdout }}"