Automation and Ansible Lab - michael-D-S/SYS-265 GitHub Wiki
Michael Sargent SYS-265-01, 2/24/2025
Automation and Ansible ,Tech Journal
Overview:
within this lab the following machines were set up, Controller, ansible01, and ansible02. Then I configured them to function with the program ansible as well as made users for them ( Deployer ).
Logins for future labs:`
deployer: username: deployer password: Dep0.10g1n
Trouble Shooting:`
Issues with wks not communicating properly with controller, ended up being that wks had the firewall blocking ICMP communication that was not allowing controller to properly reach wks.
Issues with the login for the command : ansible windows -i inventory.txt -m win_ping -u [email protected] --ask-pass , this caused one of the machines to fail as they had different login usernames. The solution was to remove the -u [email protected] portion of the command and rely on the windows category to determine the machines that would be affected.
What to learn more about:`
1. Ansible Installation on the Controller
Operating System: [Ubuntu]
Installation Method:
sudo apt install ansible sshpass python3-paramiko
Verification: A brief explanation of how you verified that Ansible was installed correctly (e.g., running ansible --version). Provide the output of the command.
2. Linux Host Preparation (ansible1 and ansible2)
Operating System: [Rocky Linux]
User Creation:
sudo useradd deployer
sudo passwd deployer # Set the password
sudo usermod -aG wheel deployer #add the user to the wheel group
SSH Key Configuration:
ssh-keygen -t rsa -b 4096
create an RSA key pair if you don't already have one
ssh-copy-id deployer@ansible1
ssh-copy-id deployer@ansible2
Passwordless Sudo: Creation of /etc/sudoers.d/sys265 on all Linux systems.
deployer ALL=(ALL) NOPASSWD:ALL
OpenSSH Installation:
powershell Run as Administrator in PowerShell
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
PowerShell as Default Shell:
Run as Administrator in PowerShell
Set-ItemProperty "HKLM:\Software\Microsoft\Powershell\1\ShellIds" -Name ConsolePrompting -Value $true
New-ItemProperty -Path HKLM:\SOFTWARE\OpenSSH -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
3. Ansible Configuration Files
Location: ansible/ansible.cfg
ansible.cfg:
Inventory File:
4. Playbooks
webmin.yml: Provide the complete contents of your webmin.yml playbook.
windows_software.yml: Provide the complete contents of your windows_software.yml playbook.
Other Playbooks (Deliverable 7):