Pages

Friday, March 12, 2021

Ansible for Vcenter Module not found error

When working with vCenter and Ansible, you may encounter an error that says "vmware_guest Module not found." This error occurs when the vmware_guest module is not installed on your system.

To resolve this error, you need to install the community.vmware collection, which contains the vmware_guest module. You can do this by running the following command:

To install it use: ansible-galaxy collection install community.vmware.

This command will download and install the community.vmware collection, which contains the vmware_guest module. Once installed, you should be able to use the module in your Ansible playbooks without encountering any errors.




Tuesday, March 9, 2021

Test WinRm connection to Windows Env

To check if WinRM (Windows Remote Management) is enabled in a Windows Server, you can use the following commands:

Test-NetConnection -ComputerName XX -Port 5986

This command tests the connection to port 5986, which is the default port used by WinRM over HTTPS.

Test-NetConnection -ComputerName XX -Port 5985

This command tests the connection to port 5985, which is the default port used by WinRM over HTTP.

If the above commands return successful results, it means that WinRM is enabled and running on the specified server.

Additionally, you can also use the following command to check if WinRM is configured properly on a remote server:

Test-WSMan -ComputerName XX

This command tests the Windows Remote Management (WinRM) service on a remote server and returns the current configuration status of WinRM.

Sed Command in MAC

The sed command is used to manipulate and edit text in Unix-based operating systems like macOS.

Method to use Sed in Mac

sudo sed -i "/kube/d" /etc/hosts

give error sed: 1: "/etc/hosts": extra characters at the end of h command


In the first command you provided, sudo sed -i "/kube/d" /etc/hosts, the -i option tells sed to edit the file in place, and /kube/d is the command that tells sed to delete any lines containing the string "kube" in the /etc/hosts file. However, this command does not work on macOS as it requires the -i option to have a backup file extension specified. The error message "sed: 1: "/etc/hosts": extra characters at the end of h command" is indicating that the command is not properly formatted for macOS.

To fix this, you can use the following command: sudo sed -i '' '/kube/d' /etc/hosts. The empty quotes after -i specify that no backup file should be created, and the '' is necessary for macOS to recognize the command properly. The /kube/d command remains the same and tells sed to delete any lines containing the string "kube" in the /etc/hosts file.

Following Syntax Worked. 
sudo sed -i '' '/kube/d' /etc/hosts