How to Install and Configure Ansible on Debian 9 for Use With Windows Server

Ansible is an open source tool for automating tasks. It manages the configuration of your Linux and Windows servers. It works without an agent which means that Ansible uses SSH and current user SSH authorization.

You can use Ansible to automate three types of tasks:

  • Provisioning: Set up several servers you need in your infrastructure.
  • Configuration management: Change the configuration of an application, OS, or device; start and stop services; install or update applications; implement a security policy; or perform a wide variety of other configuration tasks.
  • Application deployment: Make DevOps easier by automating the deployment of internally developed applications to your production systems.

This article will guide you through the install and setup process for Ansible on Debian Stretch, as well the configuration for the administration of a machine that's running on a Windows Server.

Prerequisites

  • A sudo user.
  • A Debian 9 "Stretch" server instance.

Installation

Add the following line to the /etc/apt/sources.list.

deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main

Add the repo keys.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367

Update the system.

sudo apt-get update

Install Ansible.

sudo apt-get install ansible

To administer your Windows servers, you will need to install the following packages:

  • python-pip
  • pip
  • pywinrm

Install the Python packages.

sudo apt-get install python-pip pip

Install WinRM (Windows Remote Management).

sudo apt-get install pywinrm

Confirm the Ansible Installation

Test the Ansible installation by retrieving its version using the following command.

ansible --version
ansible 2.4.1.0
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-2.4.1.0-py2.7.egg/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]

Configure Ansible for Windows Server Management

Go to the Ansible directory.

cd /etc/ansible

Edit the hosts file with your favorite text editor.

nano hosts

Add the following lines at the bottom of the windows group.

[windows]
server1.domain.local
server1.domain.local

It is necessary to create an encrypted vault containing the access identifiers for the Windows server. For that, we will create a new encrypted yml file. The file name must match the host group to which it should apply. In our case, the created group is called windows, so the file will be windows.yml.

mkdir group_vars
cd group_vars
ansible-vault create windows.yml

In your yml file, add the following parameters.

ansible_ssh_user: _your_ssh_user_
ansible_ssh_pass: _your_ssh_pass_
ansible_ssh_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore

Configure the Windows Server

A PowerShell script is available to automatically configure your machine. This script will automatically configure WinRM (Windows Remote Management) and open the firewall.

Download the PowerShell script from Github.

Modify the execution rules of Powershell scripts to allow the execution of the script.

Set-ExecutionPolicy RemoteSigned

Execute the script.

.\ConfigureRemotingForAnsible.ps1

Your Windows Server is now ready for remote management with Ansible.

Efterlad en kommentar

The Rise of Machines: Real World Applications of AI

The Rise of Machines: Real World Applications of AI

Kunstig intelligens er ikke i fremtiden, det er her lige i nuet I denne blog Læs, hvordan kunstig intelligens-applikationer har påvirket forskellige sektorer.

DDOS-angreb: et kort overblik

DDOS-angreb: et kort overblik

Er du også et offer for DDOS-angreb og forvirret over forebyggelsesmetoderne? Læs denne artikel for at løse dine spørgsmål.

Har du nogensinde spekuleret på, hvordan tjener hackere penge?

Har du nogensinde spekuleret på, hvordan tjener hackere penge?

Du har måske hørt, at hackere tjener mange penge, men har du nogensinde spekuleret på, hvordan tjener de den slags penge? lad os diskutere.

Revolutionære opfindelser fra Google, der vil gøre dit liv lettere.

Revolutionære opfindelser fra Google, der vil gøre dit liv lettere.

Vil du se revolutionerende opfindelser fra Google, og hvordan disse opfindelser ændrede livet for ethvert menneske i dag? Læs derefter til bloggen for at se opfindelser fra Google.

Fredag ​​Essential: Hvad skete der med AI-drevne biler?

Fredag ​​Essential: Hvad skete der med AI-drevne biler?

Konceptet med selvkørende biler til at køre på vejene ved hjælp af kunstig intelligens er en drøm, vi har haft i et stykke tid nu. Men på trods af flere løfter er de ingen steder at se. Læs denne blog for at lære mere...

Teknologisk singularitet: En fjern fremtid for menneskelig civilisation?

Teknologisk singularitet: En fjern fremtid for menneskelig civilisation?

Efterhånden som videnskaben udvikler sig i et hurtigt tempo og overtager en stor del af vores indsats, stiger risikoen for at udsætte os selv for en uforklarlig Singularitet. Læs, hvad singularitet kunne betyde for os.

Funktioner af Big Data Reference Architecture Layers

Funktioner af Big Data Reference Architecture Layers

Læs bloggen for at kende forskellige lag i Big Data-arkitekturen og deres funktionaliteter på den enkleste måde.

Udvikling af datalagring – Infografik

Udvikling af datalagring – Infografik

Opbevaringsmetoderne for dataene har været under udvikling, kan være siden fødslen af ​​dataene. Denne blog dækker udviklingen af ​​datalagring på basis af en infografik.

6 fantastiske fordele ved at have smarte hjemmeenheder i vores liv

6 fantastiske fordele ved at have smarte hjemmeenheder i vores liv

I denne digitalt drevne verden er smarte hjemmeenheder blevet en afgørende del af livet. Her er et par fantastiske fordele ved smarte hjemmeenheder om, hvordan de gør vores liv værd at leve og enklere.

macOS Catalina 10.15.4-tillægsopdatering forårsager flere problemer end at løse

macOS Catalina 10.15.4-tillægsopdatering forårsager flere problemer end at løse

For nylig udgav Apple macOS Catalina 10.15.4 en supplerende opdatering for at løse problemer, men det ser ud til, at opdateringen forårsager flere problemer, hvilket fører til mursten af ​​mac-maskiner. Læs denne artikel for at lære mere