win_copy ansible module does not copy or create folder if they are empty.
ex: Running win_copy on the following source will create the following result
#src -->
Main_folder\Folder1\test.txt
Main_folder\Folder2
#dest -->
Main_folder\Folder1\test.txt
Popular Posts
-
SSL/TLS Diffie-Hellman Modulus <= 1024 Bits (Logjam) Configure the following registry and restart the server [HKEY_LOCAL_MACHINE\SYSTEM\C...
-
1) Issue: { "msg": "basic: the specified credentials were rejected by the server", "unreachable...
-
Issue: After installing SCCM 2007 client, the computer is unable to download Actions and components. checking C:\Windows\SysWOW64\CCM\Logs\C...
Tuesday, April 10, 2018
Thursday, January 4, 2018
Set DNS server list on a set of clients using SCCM collections
- Create a package that calls the following PowerShell script
$logfile = 'C:\Windows\Temp\SetDNS.log'
function writetolog([string] $txt) { $Stamp = (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
Add-content $logfile -value $Stamp':'$txt
}
try{
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$DNSServers = $tsenv.Value("DNSservers") write-host "Retrieved DNS servers list successfully" writetolog("Retrieved DNS servers list successfully : " + $DNSServers) $DNSServers = $DNSServers -split ','
}
catch{
write-host "Cannot retrieve DNS servers list" writetolog("Retrieved DNS servers list successfully") exit -1 }
try{
$Interface = Get-WMIObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq “True” -and $_.IPAddress -like "53.*"} -ErrorAction Stop
write-host "Connected to WMI succesfully and interfaces retrieved" writetolog("Connected to WMI succesfully and interfaces retrieved")
Foreach($NIC in $Interface) {
try{ $NIC.SetDNSServerSearchOrder($DNSServers) write-host "DNS servers configured successfully" writetolog("DNS servers configured successfully") exit 0
} catch{
write-host "Cannot set DNS servers" writetolog("Cannot set DNS servers") exit -1
}
}
}
catch{ write-host "Cannot connect to WMI" writetolog("Cannot connect to WMI") return -1
}
2. Create a task sequence that installs the above package using Install Software task
3. Create a collection, add the clients that you need to set the DNS for
4. On that collection, set a collection variable called DNSservers and add the list of DNS servers separated by comma
5. Finally advertise the task sequence on this collection
Friday, December 8, 2017
Ansible common errors and fixes
1)
Issue:
{
"msg": "basic: the specified credentials were rejected by the server",
"unreachable": true,
"changed": false
}
Fix:
In case specified credentials are correct yet they are rejected by the server, check the following:
- Run the Ansible PowerShell script. If you face the following error while doing so, perform step
- Go to local group policy, Computer configuration, Administrative templates, Windows Components,WinRM, WinRM Service, Allow Basic authentication --> enabled
- If it still does not help, run winrm configSDDL default on cmd and give full permission for the account having access issue.
2)
Issue:
{
"msg": "kerberos: authGSSClientStep() failed: (('Unspecified GSS failure. Minor code may provide more information', 851968), ('Server not found in Kerberos database', -1765328377))",
"unreachable": true,
"changed": false
}
Fix:
- check if full computer name of the client matches that of the DNS record
- check if the client is the correct group in the inventory if you are using inventory groups to seperate clients according to the domain
3)
Issue:
Cannot find python on the remote host
Fix:
Make sure to install atleast python2.7 on the remote host. This can be done even if a lower version of python is installed on the remote host. Since changing default python version on the remote host may break its own functionality, it is advisable to configure the path to python interpreter on the ansible inventory file as follows:
[all]
remotehostnamewitholderpython ansible_python_interpreter=/usr/local/bin/python2.7(could be anywhere depending on where latest python was installed)
Subscribe to:
Posts (Atom)