Overview
How to Set up
Setup Ansible server
See the following link
Setup Ansible (Windows) Client
Configure & Allow from ansible server
- Get ansible setup script from the following URL.
- Run this script as an Administrator
PS: powershell.exe -ExecutionPolicy RemoteSigned .\ConfigureRemotingForAnsible.ps1
Note: Run the script as Administrator
Create play-book on Ansible server
- Create host list
$ vi hosts
----
[Windows]
192.168.0.1
- Create log in parameter
$ vi group_vars/Windows
----
ansible_user: 'Windows User Name'
ansible_password: 'Windows Password'
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
- Run
$ ansible Windows -i /etc/ansible/hosts -m win_ping -v
Use Case
Scope
- Copy Installer from ansible server to Windows client.
- Install the application programs (PandoraFMS)
- Copy application setting from server to Windows client.
- Start service
play book
$ vi /etc/ansible/roles/Windows/task/main.yml
----
#
# PandoraAgent-Windows Main Playbook
#
- name: Transfer pandoraFMS Agent Installer
win_copy:
src: /etc/ansible/roles/pandoraAgent-Windows/files/var/tmp/PandoraFMS-WindowsAgentv6.0SP2-160509_x86_64.exe
dest: C:\Users\Administrator\PandoraFMS-WindowsAgentv6.0SP2-160509_x86_64.exe
tags: prod
- name: Install the latest version of pandoraFMS Agent
raw: C:\Users\Administrator\PandoraFMS-WindowsAgentv6.0SP2-160509_x86_64.exe /S
tags: prod
- name: pandoraFMS Agent settings
win_template:
src: /etc/ansible/roles/pandoraAgent-Windows/templates/etc/pandora/pandora_agent.conf
dest: C:\Program Files\pandora_agent\pandora_agent.conf
tags: prod
- name: Starting & enable pandora agent
win_service:
name: PandoraFMSAgent
state: started
start_mode: auto
tags: prod
Note: PandoraFMS