3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Setup Ansible client on Windows Server

Last updated at Posted at 2016-06-06

Overview

How to Set up

Setup Ansible server

See the following link

Setup Ansible (Windows) Client

Configure & Allow from ansible server

  1. Get ansible setup script from the following URL.
  2. 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

  1. Create host list

 $ vi hosts
----
[Windows]
192.168.0.1
  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
  1. Run

 $ ansible Windows -i /etc/ansible/hosts -m win_ping -v 

Use Case

Scope

  1. Copy Installer from ansible server to Windows client.
  2. Install the application programs (PandoraFMS)
  3. Copy application setting from server to Windows client.
  4. 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

Link

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?