Giter Club home page Giter Club logo

ansible-windows's Introduction

ansible-windows

Use ansible for manage windows servers from a windows client.

Prerequisities

Ansible requires linux in the client machine (manager node), so you will need a virtual environment for the client:

  • Virtualbox
  • Vagrant

In windows servers, you must enable remote connections with PowerShell.

Follow next steps for configuration.

Running

On remote managed server

  • Requires PowerShell 3.0 installed (from powershell terminal, run: $PSVersionTable.PSVersion). Note: requires Windows Feature "Windows PowerShell Integrated Scripting Environment (ISE)".
  • Launch powershell terminal (run as administrator)
  • You can try to upgrade from powershell 2.0 with the script 'powershell/upgrade_to_ps3.ps1'.
  • Allow powershell execution
Set-ExecutionPolicy Unrestricted
./ConfigureRemotingForAnsible.ps1 -SkipNetworkProfileCheck
  • Revert allow powershell execution
Set-ExecutionPolicy Restricted

Now server is ready to be managed by ansible (with win remote connection).

On manager node (with vagrant)

  • Install VirtualBox + Vagrant
  • Edit 'Vagrantfile', to point to the local path of this project on your disk. Then, inside vagrant environment, you can acces to this project resources in /src.
...
config.vm.synced_folder "c:/src/ansible-windows", "/src"
...
  • Edit <this_project>/hosts, at the end of the file, add your remote host to manage in a list (in this example 'windows'):
[windows]
server-name1
server-name2
server-name3
  • Edit group_vars/windows.yml, replacing {domain_name}, {domain_user} and {password} with valid credentials to connect windows servers.
# it is suggested that these be encrypted with ansible-vault:
# ansible-vault edit group_vars/windows.yml

ansible_user: {domain_name}\{domain_user}
ansible_password: {user_password}
ansible_port: 5986
ansible_connection: winrm
# The following is necessary for Python 2.7.9+ when using default WinRM self-signed certificates:
ansible_winrm_server_cert_validation: ignore
# Define transport, like here: https://github.com/diyan/pywinrm#run-process-with-low-level-api-with-domain-user-disabling-https-cert-validation
ansible_winrm_transport: ntlm
  • Run virtual environment:
vagrant up
  • Connect via console:
vagrant ssh
  • Go to project base directory:
cd /src
  • Test it! Get facts from server, it must return a json with server info.
ansible {server-name} -m setup

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.