Installing Ansible on Red hat Linux 7:
- Ansible architecture contains master and slaves, Master controls all the saves and the communication is established using SSH protocol.
- Ansible software is installed in master machine, and no need to install any client soft wares on slaves.
- Ansible master should be Linux Distribution, currently windows doesn't support as master node however windows server machines can be used as slaves.
- If the slave machine is Linux Distribution then only pre-requisite is python should be installed and similarly winrm service should be enabled for windows slave machine.
Ansible is not part of RHEL default repository that ships with RedHat Enterprise Linux Subscription
We need to install EPEL(Extra Packages for Enterprise Linux) repository which is maintained by fedora for installing Ansible.
Step 1:Install the EPEL repository configuration package using the following command.
$yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
This will do all configuration, i.e adds epel.repo to etc/yum.repos.d/ and enables it.
You can verify the same using $yum repolist
Step 2:Install Ansible from EPEL repository normally
$yum install -y ansible
Check Ansible version using $ansible --version
Step 3:Install Pywinrm if you have any windows slaves in your setup.(Optional)
$pip install pywinrm
This package is required to establish connections with windows machines as it uses winrm.
Ansible Slave Setup on RedHat Linux 7:
You don't need to install any additional softwares just cross check python is installed or not, as it ships by default with all linux distributions.
Ansible Slave Setup on Windows Server 2012/2012 R2/2006/2019/10:
Prerequisites for Ansible slave:
Ensure your system is running .NET Framework 4.0 and later.
Windows PowerShell should be Version 3.0 & later
But don't worry as all above mentioned servers will have all of these.
Step 1:You need to execute below 4 powershell commands for configuration.
1.$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
2.$file = "$env:temp\ConfigureRemotingForAnsible.ps1"
3.(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
4.powershell.exe -ExecutionPolicy ByPass -File $file
Expected Ouput:
Self-signed SSL certificate generated; thumbprint: 5FAF0EAEF69EBB15A6B7CB9C80C29884D2F381C1 wxf : http://schemas.xmlsoap.org/ws/2004/09/transfer a : http://schemas.xmlsoap.org/ws/2004/08/addressing w : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd lang : en-US Address : http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous ReferenceParameters : ReferenceParameters Ok.
PS C:\Users\Administrator\Desktop> winrm get winrm/config
Config
MaxEnvelopeSizekb = 500
MaxTimeoutms = 60000
MaxBatchItems = 32000
MaxProviderRequests = 4294967295
Client
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = false
Auth
Basic = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = false
DefaultPorts
HTTP = 5985
HTTPS = 5986
TrustedHosts
Service
RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 1500
EnumerationTimeoutms = 240000
MaxConnections = 300
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = true
Auth
Basic = true
Kerberos = true
Negotiate = true
Certificate = false
CredSSP = false
CbtHardeningLevel = Relaxed
DefaultPorts
HTTP = 5985
HTTPS = 5986
IPv4Filter = *
IPv6Filter = *
EnableCompatibilityHttpListener = false
EnableCompatibilityHttpsListener = false
CertificateThumbprint
AllowRemoteAccess = true
Winrs
AllowRemoteShellAccess = true
IdleTimeout = 7200000
MaxConcurrentUsers = 10
MaxShellRunTime = 2147483647
MaxProcessesPerShell = 25
MaxMemoryPerShellMB = 1024
MaxShellsPerUser = 30
PS C:\Users\Administrator\Desktop> 192.168.2.16 | SUCCESS => {
"changed": false,
"ping": "pong"
}
0 Comments