Aug 10, 2019 - Ansible Windows win_copy is slow

I have found a few problems with using the Ansible module win_copy. The module is slow and unreliable thus causing multiple timeouts. I have found a more reliable and quicker solution by using using win_command with robocopy.

Here is an example on how I used win_copy in the past.

- name: copy ms office dir to c drive
  win_copy:
    src:  /misc/filessoftware/chocolatey/msoffice2016/
    dest: C:\msoffice
  ignore_errors: yes
  when: hostvars[inventory_hostname]['ansible_getFacts']['Microsoft Office Professional Plus 2016'] is undefined

The new solution along with mounting a network share.

- name: Transfer of msoffice2016
  win_command: ''
  with_items:
    -  'net use  s: \\nfs.fqdn.com\software /P:yes /user:  '
    -  'robocopy s:\msoffice2016 \msoffice2016 /E'
  ignore_errors: yes
  no_log: True 
  when: hostvars[inventory_hostname]['ansible_getFacts']['Microsoft Office Professional Plus 2016'] is undefined

Jul 29, 2019 - Icinga2 SNMP Temperature Check

After Icinga2 is all setup.

  1. Install nagios via yum or apt get
      apt-get install nagios-plugins
    

    or

      yum install nagios-plugins-snmp.x86_64
    
  2. Add the following /etc/icinga2/conf.d/services.conf
    apply Service "Check temperature " for (config in host.vars.temperature) {
     import "generic-temperature-check"      
     check_command = "check_temp"
     vars.hostname = config
     assign where host.vars.temperature
    }
    
  3. Add the following to /etc/icinga2/conf.d/commands.conf
    object CheckCommand "check_temp" {
     import "plugin-check-command"
     command = [PluginDir + "/check_snmp"]
     arguments = {
     "-H" = "$hostname$"
     "-o" = "$temp_oid$"
     "-c" = "$temp_critical$"
     "-w" = "$temp_warning$"
     "-P" = "$temp_version$"
     "-C" = "$temp_community$"  
     }
     }
    
  4. Edit the /etc/icinga2/conf.d/hosts.conf file to include the new host to monitor.
    object Host "environment.fqdn.com" {
     import "generic-temperature-check"
     address="10.0.2.2"
     vars.hostname="environment.fqdn.com"
     vars.temperature = "environment.fqdn.com"
     vars.temp_critical= ["90","90"]
     vars.temp_warning= ["80","80"]
     /* APC temp oid codes, these may need to be changed  */
     vars.temp_oid = ["1.3.6.1.4.1.318.1.1.10.3.13.1.1.3.1", "1.3.6.1.4.1.318.1.1.10.3.13.1.1.3.2"]
     vars.temp_version="1"
     vars.temp_community="communityName"
     vars.notification["mail"] = {
     groups = [ "icingaadmins" ] 
     }
    }
    

Jul 28, 2019 - Icinga2 SSL Check

After Icinga2 is all setup.

  1. Install nagios via yum or apt get
      apt-get install nagios-plugins
    

    or

      yum install nagios-plugins-http.x86_64
    
  2. Add the following /etc/icinga2/conf.d/services.conf
      apply Service "Check SSL certificate for " for (config in host.vars.ssl_domains) {
     check_command = "check_ssl"
     vars.hostname = config
     vars.critical = "15"
     vars.warning = "30" 
     assign where host.vars.ssl_domains
      }
    
  3. Add the following to /etc/icinga2/conf.d/commands.conf
      object CheckCommand "check_ssl" {
     import "plugin-check-command"
     command = [PluginDir + "/check_http"]
     arguments = {
       "-H" = "$hostname$"
       "-C" = "$critical$"
     }
      }
    
  4. Edit the /etc/icinga2/conf.d/hosts.conf
    object Host "webhost.fqdn.com" {
     import "generic-host"
     address = "10.0.2.1" 
     vars.disks["disk /"] = { disk_partitions = "/" }
     vars.os = "Linux"
     vars.remote_client = "webhost.fqdn.com" 
     vars.users_wgreater = 10
     vars.users_cgreater = 20 
     vars.ssl_domains = ["website.fqdn.com","websitetwo.fqdn.com"] 
     vars.notification["mail"] = {
     groups = [ "icingaadmins" ] 
     } 
    }