How to Install and Configure Ansible on CentOS 8 for Use With Windows Server

Ansible is a unique open source tool for automating tasks. Ansible is a universal language that reveals the mystery of how work is done. Turn complex tasks into repeatable instructions. Deploy enterprise-wide protocols with the click of a button. Now you can scale automation, manage complex deployments, and increase productivity with an enterprise automation platform that can be used by all IT teams.

Installation

In order to install Ansible, you first need to install the EPEL repository. This can be done using a special command:

yum install epel-release

Then we advise you to update the packages on your CentOS distribution

yum -y update

After updating the packages, install Ansible with the yum extension using a special command:

yum -y install ansible

For correct and competent administration of severs on Windows, you need to install the following packages: python-pip, pywinrm and also pip itself.

The next step is to install the Python packages. This can be done using a special command:

yum -y install python-pip pip

In order to work with Ansible in the future, you need to check the installation. By entering the command:

ansible --version

Setup Ansible

First of all, it is recommended to update the packages on your CentOS:

yum -y update

Then go to the Ansible directory

cd /etc/ansible

Edit the hosts file in your favorite text editor

nano hosts

To configure Windows and its further use, it is necessary to do the following:

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

Next, you need to create an encrypted vault that will contain access identifiers for the Windows server. To accomplish this, it is recommended that you create a new encrypted yml file. The file name must match the host group to which it will apply. In our case, the created windows group is called, which means that there will be a windows.yml file

mkdir group_vars
cd group_vars
ansible-vault create windows.yml

In the finish, you need to add the following parameters to your yml file

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

Was this article helpful?

Related Articles

Leave A Comment?