My Recap of Red Hat Summit 2019

I’m just settling back into the office after attending my first Red Hat Summit. What an adventure!!! When I first walked into the Boston Convention Center, I knew I was in the right place. Welcomed by red carpets everywhere and the spiffy new logo, with a nod to accessibility right as I entered, I knew I was where I was supposed to be. My flight got me in Monday afternoon and made it to the First Timers Reception. After I picked up my registration badge and backpack, took obligatory selfies,  I headed to the shindig.  

A huge breakout room with a multiple bars, food stations on my left and right and wait staff walking around with snacks, this room was buzzing. I knew for certain I didn’t know anyone here, so I grabbed a beer and looked for a place to hang out. Almost immediately, I was chatting it up with a few guys who were Red Hat Accelerators.  

Red Hat Accelerators are defined as:  

“The Red Hat Accelerators (RHA) program is a global customer network of Red Hat (RH) technology experts and enthusiasts who willingly share their IT knowledge and expertise with peers in the industry, the community, and with Red Hat.” 

From Red Hat

We did intros, laughed and talked until the end of the reception. One guy asked if I’d be interested in becoming an accelerator and gave me a card that had a QR code on it to find out more about the program. I was sure I wasn’t interested, but I took the card anyway and promised to check it out.  

I didn’t get into many of the sessions I’d hoped to.  I’d built my agenda in advance, but so many were filled up very fast. Success struck on a few, so I was able to build an agenda that kept me busy all week. Here is a peek and some of the sessions I attended. 

Day 1

Winning With Red Hat Enterprise Linux- As told by Our most fanatical customers. (slides) 

Wouldn’t you know, I few of the guys I’d met at the reception was on this panel. It was moderated by Marc Richter, a Red Hat Senior Technical Account Manager (TAM) and it was a Q&A about all things Red Hat. The panel talked about their joys and pain points of using RH and features and services they’d like to see improve. It was a lively session and it was really a great way to ease into the fire hose that was about to open on me.  

Making DevOps managed services work for you 

Another panel that talked about how they are implementing DevOps in their environment. I heard so many buzzwords, but one that kept being repeated was ‘velocity’. The context clues gave me an idea, but I was so surprised at just how many times it was being uttered. I guess DevOps = Velocity. However, all I kept thinking about was the Velocity Conference that was coming in June and that I wouldn’t be going to because I was slated to attend AWS Public Sector Summit in DC at the same time.  

Move at the speed of DevOps: 

This session really piqued my interest. I’m new to DevOps and I’ve been tasked with developing an environment for our developers and this seemed like the place to start. Greeted with a full house, I guessed so many others were in my boat and wanted to learn more. Text heavy slides with small fonts that I couldn’t make out, I tried to take a few photos to record some of the nuggets. Sadly, I couldn’t read them and they hadn’t released the slide deck as I’m writing this post.  One acronym they went over was PACE, which focused on 4 key pivots on the path to DevOps:  

  • Process 
  • Architecture 
  • Culture 
  • engineering  

As the talk when on, it started to feel more and more like a sales pitch. I even asked the guy next to me and he felt the same way.  The slide deck hasn’t been released yet for this talk, but I’ll surely keep my eye out for this one.  

Pulling the puppet strings with Ansible:  (slides) 

Although this was only a mini session, I wanted to attend to see what could be done with both Puppet and Ansible. We currently use Puppet for configuration management for Linux systems, but I’m 1) looking for more insight into Puppet and 2) Discover how the two can work together. This session talked about how Red Hat started with CFEngine first, and the migration to Puppet. Puppet language is hard to learn and dependency ordering proved challenging.  It was also slow and didn’t scale well. After 10 years with Puppet, they found it even harder to learn and updating modules to 5.x was nearly impossible.  

Then they moved to a hybrid approach with Puppet and Ansible. Ansible was great for orchestration and ordering dependencies was much easier. You just wrote the playbook and you were on your way. Ansible was also much easier to learn. Then came Ansible Tower. With the ability to centralize playbook execution and manage credentials, Ansible became an important part of configuration management. However, it was not going to replace Puppet. Hiera proved better at managing environment data and Puppet ERB templating was better than Jing2.  If you don’t use Ansible Tower, centralized auditing could prove challenging.  

Puppet Pain Points

Red Hat has a podcast that I listen to called, Command Line Heroes and its hosted by the one and only Saron Yitbarek of #CodeNewbie fame. They had a space set up at at the conference and with command line video games, interviews for the podcast and 2 people doing caricatures. I did a quick interview and had my caricature drawn as I talked. Pretty neat, huh?  

Desperately seeking DevOps: How do you change the way you work?  (notes)     

This session wasn’t what I was expecting. It was a “birds-of-a-feather” session which meant you were in a room with other Red Hat customers that were also desperately seeking DevOps. This session started kind of like an ‘unconference’, where you wrote down topics that you’d like to talk about and the attendees would vote for 3 suggestions each by putting a dot on the post-it note that had an idea they would be interested in talking about.   One of my topics got picked for discussion.  You’ve decided on the DevOps approach, now what? Sadly, it was less about what tools folks were using and the onboarding involved, but more about how to change the culture in order to even begin the process. Bigger organization seemed to have much more friction with changing mind sets than anything else. One company did find success with making sure teams were trained. They took time to level the team up with workshops on things like Python, learning the tools, etc. More time up front yielded better results from the teams involved. Also, developers had to be included in this training because they had to learn and be responsible for their role in the pipeline.  

Voting on which topics to discuss

At the end of a very long day, they held the General Sessions which lasted 2 hours. Seating was difficult so I sat on the floor in the back of the hall. After that became impossible, I found the Active Lounge. It was empty and had a TV casting the session. I put my feet up and watched. There was a conversation between the Red Hat CEO, Jim Whitehurst and IBM CEO, Ginny Rometty. Fun fact, I met Ginny at Microsoft Ignite in 2017.  There was a women’s lunch during the conference and it was very well attended. I’d registered well in advance, but it was hard to find seating. As the usher walked me around the room, Ginny invited me to sit at her table with her and her colleagues in the front of the room. It was an honor and a very nice gesture. Of course I stuck out like a sore thumb in my jeans and t-shirt while the ladies were resplendent in their dresses and suits, but I didn’t care, I had the best seat in the house!  Anyway, I digress. They spoke about the history of open source and how both companies invested in it over the years. Jim said, “Open source is the vehicle for innovations that matter” and that got a big round of applause. Ginny got her own round of applause when she said, “We’d like to keep Red Hat separate”.  

A Round of Applause for keeping Red Hat separate from IBM

Another great conversation was Jim speaking with Satya Nadella, the CEO of Microsoft and their commitment to open source, the flexibility of hybrid and edge cloud. There was also the big announcement of general availability  (GA) of the Azure Open Shift Service. Many CEOs got on stage and talked about how they’re using Red Hat products to further their own innovations. Other big announcements were GA for Red Hat Enterprise Linux 8 (RHEL 8), the Red Hat Universal Base Image (UBI) and Red Hat Insights adding support for Microsoft SQL Server for Linux.()  

As the keynote wrapped up, the welcome reception that followed was held in the expo hall. Vendors we’ve all heard of had booths and plenty of swag to give away.  

Day 2

Mental shift from system admin to system architect: 

This session was more from the move from sysadmin to leading a team, but I found some nuggets that proved helpful. Thinking in terms of growth for the team and identifying my own strengths and weaknesses aids that shift. Also keeping up on tried and true technical skills as well as developing new skills. Lastly, creating a roadmap for future growth and reviewing it often to stay on track. 

Next, I rounded off my morning with 2 session on open organizations and open leaders.   

Giving people a voice in an open organization: (slides) 

We’ve all been in an organization where there is one person that is always talking and there are some folks that never speak up. This session focused on how to “create an environment where everyone is heard equally”. Let by 2 Red Hat staffers, this session talked about processes that helped teams communicate better and “collaborate on equal terms regardless of tenure”. This session spoke to me. I’ve seen this dynamic where there is someone that is always talking and over the years, I’ve tried to be the person in the room that pays attention to faces. Sometimes faces change with they agree or disagree with something that’s being said. I try to direct questions to people who look like they have something to say and keep them included in the conversation. I know how it is to be the quiet one in the room and those small gestures are sometimes just enough to make a space more inclusive.  

Beyond engagement: What open leaders need to know about empowering others (slides) 

This session followed up the previous session quite nicely. Led by another Red Hat employee, this one talked of how we empower individuals just as much as we empower teams. She talked about how leaders should build other leaders to both further the growth of the company but also, growth of the individual. This helps “every individual reach his or her potential”. She provided a link to the open organization maturity model, a framework that Red Hat uses to help teams, individuals and the organization as a whole become more transparent and inclusive.

One thing this session reminded me of was Proverb 27:17 As iron sharpens iron, so one person sharpens another.    

Puppet and Ansible in Foreman: 

This session was in the community theater in the expo hall and the sound was so poor, I couldn’t hear the speaker. I didn’t know what Foreman was, so I had to look it up. Foreman is a server lifecycle management and orchestration tools. It is commonly used with Puppet and Chef. It would have been nice to learn more.                                                                                                                                

Since I was in the expo hall, I skipped my last session of the day and explored the expo hall. I took some hands-on demos in the Red Hat Booth and got t-shirt for completing each one. Once you did 3, you got a hoodie as a bonus!  

Day 3: 

Centos 8 and Beyond: 

This was another session held in the expo hall and it was hard to hear the speaker. It was mostly a Q&A between the speaker, a Red Hat employees who works on the Centos project and the audience. There is no ETA on the release of version 8, but it’s coming. There was an overview of the build process, how Centos is working with Fedora as well as the steps to get it to GA. 

Open Management: The next frontier in open culture: 

This was a panel discussion of Red Hat managers and they did a Q&A on how they are using the open culture to support teams and individuals as well as how managers are still necessary and what part they play in an open culture. They’d have a question on a slide and each manager got a chance to reply.  A few nuggets I took away were that empathy is a necessary quality in a manger. How can you manage humans if you have no empathy? Not having a empathetic manager is a cancer IMO. Why would you even try if your manager doesn’t exhibit empathy. If they don’t care, how can you?  

In between sessions, I check twitter and I’d discovered that Linux Academy just added RHEL 8 to the cloud playground! 

Manage Windows with Ansible: The what, the why, and the how? (slides) 

This was the session I’d looked forward to the most. I want to do more automation in deploying Windows systems here, and we’re just not there yet.  I’d already heard about how well Puppet and Ansible work together, but this session just focused on Ansible and Windows.  There were a few code examples on how the declarative language of Ansible can help build, patch, secure and configure Windows systems. Also, tips on software management and how great PowerShell DSC is with Ansible. After sitting through this packed session, It was good to know that Linux wasn’t the only party in town and the automation pain points for Windows administration still exist, but there are ways to make it easier with Ansible. However, learning PowerShell and DSC and even more python are in order. To make writing playbooks even easier, there is a an Ansible extension for Visual Studio Code.

There was a call to action at the end of the talk to “Learn how to Ansible”. I’d used Ansible for Linux in a test environment before, but never in production and NEVER for Windows. I think I’ll take his advice and wade in. 

Security-Enhanced Linux for mere mortals: 

I’ll admit it, I don’t get SELinux. It has been something always caused more problems that it solved IMO. As a mere mortal, I signed up so I could get a better understanding of how to enable it and not break everything. The speaker understood the pain point of how hard it was to even grasp SELinux, the documentation is the beginning was downright horrible, but over the years, it has gotten better and SELinux is much easier to manage.  

He showed scenarios and demos on how to configure, set rules and policies and troubleshoot SELinux issues. I had to agree, it did SEEM easier in the situations he’d presented, but more understand would definitely be needed. I’d thought I would be able to walk away from the conference without one snarky comment about Windows Admins, but I was wrong. He had to throw in the tired old trope, “It’s so easy, even an Windows Admin can do it” at the very end. Alas, no conference is ever perfect.

SMH

I’d learned quite a bit about what tools and services Red Hat and the ecosystems surrounding them provide. There were so many that I hadn’t even heard of before, but I guess that’s why you go to conferences, to gain a new insight on what’s possible and find out more about things you only know by name. I’m looking forward to attending again. It was a great experience. Who knows, maybe next year I’ll be back as an accelerator. 

Installer must be run as administrator

I just got a call from the helpdesk that a tech wasn’t able to install from an MSI on the apps share from a file server. I checked his share & security permissions (OK) he could install other MSIs(OK)

I copied the file to the workstation he was working on and still the same error. Whelp, it’s not the share. Checked that he was in the local admins group on that Windows 10 workstation (OK) had him reboot and still no go. He was not able to run the MSI on this system. I had him launch an command prompt as administrator, browse to where I put the MSI and had him install using msiexec.

msiexec /a "NameOfInstaller.msi"

The /a option means to install it as administrator. It worked for him.

Command not found when using MYSQL from the command line on osx

I want to run some mysql command from my terminal, but each time I run mysql -u root to log in, I get an error:

-bash: mysql: command not found

This is because mysql isn’t in my PATH.  Your path is an environment variable that holds directories that your computer will search through to find executable files. You can review what’s in your path by running:

# echo $PATH

This will show you the list of directories that are in your path.  This variable is stored in your .bash_profile. On most macs, the .bash_profile file is located in the root of your home directory. To view the current .bash_profile file, go to your home directory

# ~ 

From there, run the ls command to view all files.

# ls -alh

 Near the top of the listing is the .bash_profile file. Cat out the contents to see what’s in your path.

# cat .bash_profile

To update the file, backup your current .bash_profile

# cp .bash_profile .bash_profile_backup

To locate your mysql executable, use the locate command.

# locate mysql | less

Since I’m running MAMP, my mysql executable is located in  /Applications/MAMP/Library/bin/mysql  To add this to the end my path, run the following command.

# echo 'export
PATH=$PATH:/Applications/MAMP/Library/bin' >> ~/.bash_profile

This takes the output of the echo command and puts it into your .bash_profile. Now, you make it persist by sourcing it. This alerts the current terminal to reload the file.

# source ~/.bash_profile

Now you can echo path again to confirm or cat out your file

# echo $PATH

Now, we can use the mysql command from our current location. Enter the password, if prompted.

# mysql -u root -p

Now, you can run your commands with ease.

To quit the mysql cli, run:

# \q

How to reset lost or forgotten MYSQL password

List of sql fields in user table

My system is as follows:

  • Ubuntu 16.04.4 LTS
  • Mysql 5.7.22

Stop the mysql process:

sudo /etc/init.d/mysql stop

Use mysqld_safe using the –skip-grant-tables option to start the process:

sudo mysqld_safe --skip-grant-tables &

If you get an error about: mysqld_safe Directory ‘/var/run/mysqld’ for UNIX socket file doesn’t exist, check 2 things.

  1. If you have a /var/run/mysqld directory, if not, make one and change the permissions with chown.
  2.  In the /etc/mysql/ directory, there is a file called, my.cnf open it and add the following:
sudo chown mysql:mysql /var/run/mysqld
[mysqld]
port=3306
socket=/var/run/mysqld/mysql.sock

Save and close this file and re-run sudo mysqld_safe –skip-grant-tables &

You should see a message that reads: mysqld_safe Started mysqld daemon with databases from /var/lib/mysql

Output from mysqld_safe command

Open another terminal and log into mysql

mysql -u root

Now you can reset your password. Run these commands:

mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD('pass123') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

If you get an error when running the UPDATE user command that reads: ERROR 1054 (42S22): Unknown column ‘password’ in ‘field list’, do this next.
Assuming this is for the mysql database:

mysql> use mysql;
mysql> show tables;

List of tables in mysql
If you don’t see a row called password, but there is a user field, run this:

mysql> describe user;

 

List of sql fields in user table

There is a row called ‘authentication_string’ that holds the password.

You will need to run this command to reset the password. Just like the command above, but referencing the correct field in the user table.

mysql> use mysql;
mysql> UPDATE user SET authentication_string=PASSWORD('pass123') WHERE user='root';
FLUSH PRIVILEGES;
quit

Log back in and test your new mysql password

 mysql -u root -p

User Powershell to see which AD groups a users belongs to

For the past upteen years, to get a list of the groups a user belongs to, I’ve used:

> net user /domain userID

Today, I just stumbled upon a powershell cmdlet that does just that.
Get-ADPrincipalGroupMembership

To get a list of groups a users belongs to run the following at a powershell prompt.

PS c:\ >Get-ADPrincipalGroupMembership userID | select name

 

Screenprint of Powershell window

Note: You will need the Active Directory Powershell module and that comes from installing RSAT.

Configure logrotate on a specific log file

There is a log file that I only want to keep 4 days worth of logs for.  Here is how you configure logrotate to rotate logs to your specific needs.

Logrotate is a system utility that rotates, compresses and mails system logs as needed on your Linux system.  Located in /etc on RHEL based systems, it has default parameters set for certain files, but also allows for you to chose your own files to be rotated, as needed. To configure /var/log/slapd to rotate logs daily and only keep them for 4 days, here are my steps.

Switch to root and vi /etc/logrotate.conf

~ ] # vi /etc/logrotate.conf

At the bottom of the file, there is a section where system-specific logs can be configured for rotation. G$ to get to the end of the file and i for insert. Make a new line and enter the path to the file with opening and closing bracket to  place your rotation parameters.

Screenhost of logrotate.conf

  • missingok means that if the file is missing, go to the next one and don’t throw an error.
  • notifempty means that the file shouldn’t be rotated if it’s empty.
  • maxsize is the max size the file can get before it’s rotated. 20M is the size of the file in megabytes.
  • daily means the log file will be rotated every day.
  • create  0644 root root means that log file that is rotated, a file will be created with 0644 mode set on the file. The owner and group on the rotated file will be root.
  • rotate 4 means that the log will be rotated 4 times before it’s removed from the system.

Close the file, :wq! and run logrotate to see if it’s working.

~ ] # logrotate -v /etc/logrotate.conf

I used the -v switch to see the verbose output of the command.

Output of running logrotate

The output tells you what is happening during the running of the command. It runs against the slapd file and lists the rotation schedule, then says it won’t run against empty files and that old log files will be removed. The file is rotated and a suffix is appended to the old log file. It lists the glob pattern (it resembles regular expressions, but much simpler ) and looks for old files to delete. As you can see, there were none.The file is renamed and a new file is created with the mode you stated. I list the files and as you can see, the file has been rotated and a new, blank is ready for the days logs.

The man pages for logrotate and logrotate.conf are very helpful in this case. Be sure to read them to see how many options you can use to configure your logs to rotate.

 

Assigning Registered Domain Name to Lightsail Server

There are a few prerequisites to assigning a domain name to a Lightsail instance.

  1. You must have a domain name registered with a provider of your choice.
  2. A running Lightsail server
  3. Static IP assigned to your server.

Assign Static IP to Lighsail server

Log into the Lightsail Console and click on the Networking Tab

Lightsail Console- Instance Tab

Click Create static IP

Lightsail Console-Create Static IP

Select your static IP location. Note, you must already have an instance running in that region in order to attach a static IP to it.

Lightsail Console-Select IP Region

Select the instance that you’re assigning the static IP to from the drop down box. Give your static IP an unique, recognizable name. Click create.

Lightsail Console-Attach to an instance

Once you’ve clicked create, your IP will have a pin next to it, noting that is it attached to the instance.

Lightsail Console- Pinned Static IP

Assign DNS Zone to Lightsail server

Click on the HOME menu at the top of the page. Click on Networking > Create DNS zone

Lightsail Console-Home button

Lightsail Console-Create DNS Zone

Enter your domain name and click Create DNS Zone.

Lightsail Console-Enter Domain Name into DNS Zone

Click Add Record:

Lightsail Console- Add A Record

Lightsail Console- Add A Record and Domain Name

 

Add an A record:

Make sure the Type is A. Click in the subdomain box and enter www.yourdomain.com .

In the destination IP box, select your Static IP name and click save.

Nameservers:

You will be given a list of name servers to point your domain to.  I’m using Hover and here is how I point my domain to my Lightsail server.

Log into your  Hover account and on the overview tab, scroll down to nameservers and click edit.

Hover Console- Tabs

Hover Nameservers

Enter the name servers give to you in the DNS records tab in your Lightsail console. You must add at least two. Add additional nameservers by clicking the plus sign. When you’re done. Click Save Nameservers.

Hover- Edit Nameservers

Edit DNS Records:

Click on the DNS tab and review your current DNS settings. Click edit next to the A (*) record and enter the static IP or your Lightsail server.

Hover Console - DNS Records

Hover- Edit DNS Records

Click Save Changes and repeat for the A(@) record.

Test your changes by entering your domain name into a browser to see if your website loads.

If it doesn’t load immediately, be patient. It can take anywhere from 24-48 hours for DNS to propagate.

 

WordPress on AWS

I was invited to Philly ‘burbs WordPress meetup to give a talk about how to install WP on AWS. I’d given this talk before in an impromptu setting, my dining room table, to my monthly coding group. It was more of a workshop, really hands on and at the end, everyone was a command-line hero in my book. Most, never having logged into a Linux server before, let alone deploying a server in the cloud.

Woman gesturing at Screen
Photo Cred: @accessamy

Liam, the group leader, saw a tweet about it and invited me to present it to his group. Here are the videos and the slide deck from the MeetUp.

WordPress on AWS Part 1:
https://youtu.be/e3GaqR0r7Os
WordPress on AWS Part 2
https://youtu.be/CCZPKvHvYlU
WordPress on AWS Part 3
https://youtu.be/ksVu2YbMLeg
Slides:
https://bit.ly/2qkuvEN

 

 

 

How to SSH into your Lightsail Server from Windows

Lightsail is an Amazon Web Services (AWS) offering that allows you to quickly spin up a preconfigured virtual private server (VPC). It’s a wizard-driven server deployment that has everything you need to get a server up and running quickly and for a low and predictable price of $5 month. It a great way to get your app, blog or website off of shared hosting and onto it’s own server where you don’t have to jockeying for resources and you can scale up, if needed (not a hot add, but there are ways to increase your bundle)

When you deploy your server, you’ll be asked to download your key pair.

If you didn’t do it then, you can always go back to your instance and download them now.

I’m working on a Windows 10 workstation, so I’ll be using Windows tools to do this:

  • PuTTY Key Generator
  • PuTTY

Both can be downloaded here.

These tasks can be done on Linux and MacOS using the native SSH commands from the terminal and the .pem.

Open PuTTY Key Generator. Go to Conversions > Import Key

Generate a private key with PuTTY Key Generator

Browse to the .pem you download from Lightsail. Click Save Private Key. Give the private key a name and click save.

Save the generated private key with Key Gen

enter hostname

Close key gen and launch PuTTY. Enter the server IP, under Saved Sessions, give it a name then click on Connection > SSH > Auth. Browse to the private key you just created. Scroll back up to the Session category and click Save. Click open to launch your SSH session. Log into the server with the username.

Browse to the private key

log into your server

Compare 2 files with PowerShell

I’m building a new 2012R2 server that will replace an existing 2008R2 application server. I want to see what roles I need to install on the new server, so I run the Get-WindowsFeature cmdlet in PowerShell to give me what I need.

PowerShell Get-WindowsFeature Output

I have saved the output of Get-WindowsFeature to .csv on 2 servers, a new server and the old, production server.

PS> Import-Module servermanager ; get-windowsfeature | where-object {$_.Installed -eq $True} | format-list DisplayName > old-roles.csv

PS> Import-Module servermanager ; get-windowsfeature | where-object {$_.Installed -eq $True} | format-list DisplayName > new-roles.csv

To compare the files, use the compare-object cmdlet.

From Microsoft:

The Compare-Object cmdlet compares two sets of objects. One set of objects is the “reference set,” and the other set is the “difference set.”

PS> compare-object $(Get-Content K:\old-roles.csv) $(Get-content K:\new-roles.csv) -includeequal

 

Side Indicator Meaning
== Item appears in both files
=> Item only appears in the difference set
<= Item only appears in the reference set

PowerShell compare-object output

The -ReferenceObject and -DifferenceObject options weren’t needed in this example. I got the same output with and without it.

So, on both new and old server, File Server, Remote Server Administration tools, are installed.
The new server has its own default roles and features installed and the old server has the list of roles that must be installed onto the new server, if applicable. The old server is 2008 and the new server is 2012 R2. Many features are now either default (PowerShell) or updated (.NET Framework 4.5). This list isn’t one to one, but it gives me an idea what needs to be installed in order to migrate a service from one OS to another. T

There are many useful applications for diff’ing files. What are some of your most common uses?

In addition:

You can assign the files to variables and use the split() function to get rid everything up to a delimiter and output the ‘newly cleaned’ file to a new file.

$old = Get-Content .\old-roles.csv
$new = Get-Content .\new-roles.csv

Get-Content $old | ForEach-Object {$_.split(":")[1] } > sorted-old-roles.txt
Get-Content $new | ForEach-Object {$_.split(":")[1] } > sorted-new-roles.txt

$newsort = ".\sorted-new-roles.txt"
$oldsort = ".\sorted-old-roles.txt"
Compare-Object $(Get-content $oldsort) $(Get-Content $newsort) -includeequal

Split Fucnction results

Of course, just using the diff command on both files in Linux would have given me what I needed in 5 seconds, but as we know, it’s all about learning the process.

Linux diff output
Linux would have made comparing the files a little bit easier

Gutter Markings Meaning
White space These lines are common in both files. In both files, you have chicken breast, tofu and naan.
> The files differ here. the second file listed in the command has this entry. The first file doesn’t, like milk, eggs, bread and broccoli.
< The files differ. The first file only has this entry. The second file doesn’t, like avocado, almond mil and peanut butter.
| These lines differ, meaning if we were to merge the two files, we’d have to resolve if we want to keep one or both entries.
Social media & sharing icons powered by UltimatelySocial