Oct 1, 2022 - Installing Apache SuperSet

Update, Upgrade and install Dependancies

apt-get update
apt-get -y upgrade
apt-get -y install build-essential libssl-dev libffi-dev python3-dev python3-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev libpq-dev python-is-python3

Install Superset set with pip on Ubuntu 20.04 while version locking a few packages

pip install --upgrade pip
pip install --upgrade pip --no-warn-script-location
pip install werkzeug==2.0.3 --no-warn-script-location
pip install flask==2.1.3 --no-warn-script-location
pip install wtforms==2.3.0 --no-warn-script-location
pip install --upgrade pyopenssl --no-warn-script-location
pip install psycopg2-binary pillow gunicorn gevent --no-warn-script-location

pip install apache-superset --no-warn-script-location

Configuring Superset and create a Superset user

sudo echo -e 'export FLASK_APP=superset' >> /etc/profile.d/superset.sh
  
export FLASK_APP=superset
FLASK_APP=superset /home/ubuntu/.local/bin/superset db upgrade

FLASK_APP=superset /home/ubuntu/.local/bin/superset fab create-admin --username admin --firstname Fname --lastname Sirname --email admin@domain.com --password <PASSWORD>

FLASK_APP=superset /home/ubuntu/.local/bin/superset init

Starting the application

#enable the python venv
source super/bin/active	 
export FLASK_APP=superset
superset init
superset run -p 8088 --with-threads --reload --debugger --host 0.0.0.0

Configuring Apache2 as Proxy with SSL

sudo apt install apache2

Create the following sites in /etc/apache2/sites-available. Please change the 10.0.0.8 to the proper ip or domain.

/etc/apache2/sites-available/wesite.conf

<VirtualHost *:80>
    #ServerName server.domain.com
    #ServerAlias server.doamin.com

    #Redirect permanent / http://10.0.0.8:8088
    Redirect permanent / https://10.0.0.8

</VirtualHost>

/etc/apache2/sites-available/wesite-sll.conf

<VirtualHost *:443>
    #ServerAdmin root@domain.com
    ServerName 10.0.0.8

    #DocumentRoot /var/www
    #ServerAlias fqdn.domain.com

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
    SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
 
    ProxyPass / http://10.0.0.8:8088/
    ProxyPassReverse / http://10.0.0.8:8088/
    ProxyRequests off
    ProxyPreserveHost On
    SSLProxyEngine On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
</VirtualHost>

Create an SSL Certificate

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt

Enable the Apache sites, enable SSL and start the Apache2 service

sudo a2ensite website.conf
sudo a2ensite website-ssl.conf
sudo a2enmod ssl
sudo systemctl restart apache2

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" ] 
     }
    }