Sunday, July 31, 2022

Information Technology Manager - How to IT the right way

Not every company needs an IT manager. Small operations may call for a simple setup that calls for collaboration over Goole services. No need to pay 6 figures for a person to give you that solution.

But far too often, I've seen horribly run IT departments. They focus on things that don't support company goals, they neglect things that enhance performance and security. They can even burn out IT employees, pushing them out the door, losing productivity since they now have to spend time training a new employee.

Here are some tips when it comes to running your IT department.

Organizational leaders must trust and empower their IT manager.

This is non-negotiable. This is not saying that you should blindly agree with everything they say. But you should give them direction, give them a budget, and get the hell out of the way.

A good IT manager should have a diverse background, hopefully someone with previous management experience. You should respect them and they should be able to effectively translate IT-speak to terms that management understands.

But most of all, a good IT manager will understand company goals, author policies to support those goals, and have a plan to leverage IT to support an organization's objectives.

What not to do? If you oversee the IT manager, don't get into the weeds and do their job for them (aka micromanage). Don't pluck IT personnel for special taskings (ex. manual labor help) without first consulting with the IT manager and understanding what impact that may have on IT operations. Don't give them the solution; instead, give them the problem and let IT give you the solution.

What can an IT manager do for you?

An IT manager can do several things:

1. It starts with understanding company objectives, culture, and what they may be inheriting.

2. They should author policies that align with company objectives.

3. If IT is not fully supporting the organization as you'd like, they should present several courses of action and what those actions will cost.

4. They should present a roadmap on how to get to an ideal state.

5. They should be well informed and ready to present senior leaders with information such as: security posture, operational performance, ongoing project statuses, upcoming maintenances and impacts, accomplishments as well as shortcomings.

6. IT managers should implement programs such as: monitoring, security (recommend you have a separate security manager that serves as a 'checks' for IT), maintenance, asset management, training, and systems lifecycle management.

7. IT managers should play an active role in streamlining operations.

8. And last but not least, their people should want to work for them, not the other way around. Managers should challenge, but not overwhelm their employees. They should praise in public and punish in private. Managers should complain up, not down.



Feedback welcome.

Wednesday, May 11, 2022

Ansible - Extract Dictionary Values When Nested Inside A List - Python solution

Ansible has some great built-in filters that can be found here. Two filters worth noting is items2dict and dict2items. These two filters enable you to either convert a list to a dictionary format, or a dictionary to a list format.

There is one problem though. What if you have a dictionary that is embedded into a list and want to extract dictionary values into a list? This is where it gets complicated.

OR, you can take advantage of the Ansible custom filter option and create your own filter.


#!/usr/bin/python3
#
# itemdict_to_item.py
# This iterates through a list of dictionaries,
#   extracts a dictionary value and combines
#   the values into a list.
#
# Example:
#   my_list[{'my_key': 'value1'},{'my_key': 'value2'}]
#
#   Apply the filter as so:
#     {{ my_list | itemdict_to_item('my_key') }}
#
#   Returned result:
#     ['value1', 'value2']
#
class FilterModule(object):
  def filters(self):
    return {'itemdict_to_item': self.extracted_values}

  def extracted_values(self, outer_list, passed_key):
    # Create a blank list that will hold the extracted
    #   values.
    ret_list = []
    
    # Loop through the list. If the key exists in the
    #   nested dictionary, append its paired value to
    #   ret_list
    for nested_dict in outer_list:
      if passed_key in nested_dict:
        ret_list.append(nested_dict[passed_key])
        
    return ret_list

You'll need to create a directory called filter_plugins within the same directory as the playbook you're running. Your Python script will go in the filter_plugins directory. The file name is irrelevant, just be sure it ends with .py


[dan@localhost playbooks]$ ls
my_playbook.yml filter_plugins

[dan@localhost playbooks]$ ls filter_plugins/
my_custom_filter.py

Finally, I use it in an Ansible play. I want to create a list of files that are in a directory.


- name: Get files in directory
  ansible.builtin.find:
    paths: /some/directory
  register: search_results
  
- name: Set Fact
  ansible.builtin.set_fact:
    search_list: "{{ search_results['files'] | itemdict_to_item('path') }}"

Tuesday, January 1, 2019

Calculate Average Speed in Google Sheets

Here's how to calculate average speed in Google Sheets.  In this case, I'm calculating average miles per hour.  I rounded to minutes.


CDE
2Dist (miles)TimeAvg MPH
39.580:50:1311.50
Column D is formatted as Duration.  HH:MM:SS

E3=(60/((hour(D3)*60)+minute(D3)))*C3

This equation converts the duration into minutes.

The "hour" function returns the hour value in the duration. I then multiply the returned value by 60.

The "minute" function returns the minute value in the duration.

I then add both minutes from the "minute" and "hour" function to get total minutes.

Quick algebra gets you your result:

E3 60
-- == --
C3 D3

or

X 60 minutes
------------ == -------------
9.58 miles 50 minutes

Monday, January 20, 2014

Debian 7.2.0 Wheezy on ASUS UX32A Zenbook

Operating System: Debian 7.2.0 Wheezy amd-64

I'll start by saying that this was, by far, the most successful out-of-the-"box" Linux install I've ever done.  It's been a while though, so I've obviously missed out on a lot in the Linux desktop world.

Hardware Specs:
ASUS Website
ASUS Zenbook UX32A
Intel® Core™ i5 3317U Processor
Intel® HM76 Express Chipset
8 GB RAM (upgraded from 2 GB)
250 GB SSD Drive (upgraded from 500 GB 5400 RPM hard drive)
24 GB mSATA SSD
Display: 13.3" 16:9 HD with EWV (1366 x 768)
Graphics:Integrated Intel® HD Graphics 4000
WiFi: Intel® Centrino® Advanced-N 6235


Why?
I originally was not pleased with the Windows 7 build.  It came with minimal bloatware, but I found it to be slow.  I attributed much of this to the hardware limitations, but knew that I could run a lower overhead Linux setup that would be more responsive.  I was also looking to run virtualization software, and knew a lower overhead build would be more ideal.

Preparation:
USB Drive
External CD/DVD Drive via USB
Wireless Firmware: iwlwifi-6000g2b-ucode-18.168.6.1.tgz
Debian Installation CD

FIRST:
Uncompress iwlwifi-6000g2b-ucode-18.168.6.1.tgz and place file iwlwifi-6000g2b-ucode-18.168.6.1 onto root of USB thumb drive.  This is needed for network installation via WiFi

Directions:
Connect external CD/DVD drive to laptop USB port.  Boot laptop with CD inside drive.  You should be fine with all default options, but I did decide to place the SWAP partition onto 20 GB of space on the mSATA drive.  It will eventually ask you for the iwlwifi-6000g2b-ucode-18.168.6.1 file.  Place USB thumb drive into spare USB port and it should automatically find it.

Since I was installing over a very slow network, I decided to only install the Desktop, Laptop, and System Tools packages.  I'll install others once I receive the full DVD set in the mail.

Reboot:
Booted fast and, as I expected, it installed Gnome as my desktop environment.  I may install XFCE later in order to free up resources for my virtual machines.  However, it's pretty snappy with Gnome.

Tested:
WiFi: Works great with 802.11g.  Have not yet tested with N,A or B (may never test A or B).
Bluetooth: Not yet tested
Mousepad: Works
Keyboard: Works
Function Keys: Works with volume and keyboard dim.  Haven't tested anything else.
Volume: Works
USB Ethernet Adapter: Not yet tested
Headphones: Works
Mic (built-in): Works
Webcam: Works
HDMI: Not yet tested

Issues:
Doesn't always automatically mount external USB devices when I plug them in after boot.  You can either reboot with the device plugged in prior, or dive into the command line to mount.  OR, I updated the preferences to prompt me anytime an external device is plugged in.  So far, this seems to have fixed the problem.

Default movie player had extremely low volume, but Banshee player was fine.  alsamixer volume was up.  I read that it could be due to conflicting codex, but installed VLC player and everything returned to normal volume.

Overall Impression:
It's been a while since I've done a Linux install and I couldn't be more impressed.  I didn't have to separately install codex, flash player, or java.  Mostly, I was overly-impressed with how many functions worked off the initial install.  I'm accustomed to at least one thing not working and having to research fixes.  The low volume for videos was the worst thing I encountered and if it's the only problem I have, it would be, to date, the most successful Linux install attempt in the several dozen installs I've done.

I plan on updating this blog entry as I test more.  But for the meantime, it has exceeded my expectations and am content with the end result.

Feedback:
Please let me know if there is anything that you'd like me to test.  I'm willing to try anything I can undo.