Skip to content

Instantly share code, notes, and snippets.

View cybergavin's full-sized avatar

cybergavin cybergavin

View GitHub Profile
@cybergavin
cybergavin / ovs-commands.sh
Created January 13, 2021 02:25
Open vSwitch Useful Commands
# Get OVS version
root#> ovs-vsctl -V
ovs-vsctl (Open vSwitch) 2.5.10
Compiled Oct 5 2020 18:07:51
DB Schema 7.12.1
# List OVS Bridges
root#> ovs-vsctl list-br
br.dmx
br.microseg
@cybergavin
cybergavin / gitlab-ce_upgrade.md
Last active February 15, 2021 19:42
gitlab-ce Upgrades
  • Upgraded GitLab (on RHEL 7) from v11.1.4 to v13.8.0

  • Refer upgrade paths at https://docs.gitlab.com/ee/update/

      11.1.4 --> 11.11.8 --> 12.0.12 --> 12.1.17 --> 12.10.14 --> 13.0.14 --> 13.8.0
    
  • Install gitlab-ce repos

      curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
    
  • For each upgrade path

@cybergavin
cybergavin / gitlab-ce_UI_Cert.md
Last active February 15, 2021 19:41
gitlab-ce UI Cert
  • Upload new key - /etc/gitlab/ssl/gitlab.key

  • Upload new cert - /etc/gitlab/ssl/gitlab.crt

  • Update the following section in /etc/gitlab/gitlab.rb

    nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.crt"
    nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.key"
    
  • Reload config for nginx

sudo gitlab-ctl hup nginx

@cybergavin
cybergavin / curl-from-gitlab.txt
Created January 24, 2021 03:09
Curl content from gitllab repo
# Find Project ID
# To get raw content of file build/setup.py in private project with Project ID 32
# Generate Personal access token with "read_repository" privilege
curl -LJO --header "PRIVATE-TOKEN: <token_value>" https://git.test.ca/api/v4/projects/32/repository/files/build%2Fsetup.py/raw?ref=master
# If the project is public
curl -LJO https://git.test.ca/api/v4/projects/32/repository/files/build%2Fsetup.py/raw?ref=master
@cybergavin
cybergavin / ntx-api.sh
Created January 26, 2021 06:07
Nutanix API Calls
# Get VM UUID from PC
curl -k -X "POST" \
-H "${acceptHeader}" \
-H "${authHeader}" \
-H "${contentHeader}" \
-d '{"kind":"vm","filter":"'"vm_name==$userDataHostname"'"}' "${ntxApiEndpoint}" \
| jq -r --arg VM $userDataHostname '.entities[] | select (.spec.resources.guest_customization.cloud_init.custom_key_values.hostname==$VM) | .metadata.uuid'
#Example Output:
#---------------
@cybergavin
cybergavin / rhsub.md
Last active February 15, 2021 19:46
Red Hat Subscription
  • Register new system on Red Hat Portal

  • Download Identity certificate for new system

  • Extract cert and key into /etc/pki/consumer/cert.pem and /etc/pki/consumer/key.pem and the system should be automatically registered

  • Attach subscriptions usig the Portal or the following:

    subscription-manager attach --pool=<pool-id>
    
  • In order to receive repos, you must ensure the following:

sudo subscription-manager config --rhsm.manage_repos=1

@cybergavin
cybergavin / AD-ListDirectReports.ps1
Last active March 11, 2021 13:55
AD - List directreports
List sAMAccountName for direct reports to a manager in Active Directory
Get-ADUser -Identity <manager> -Properties directreports | select-object -ExpandProperty DirectReports `
| %{Get-ADUser $_ | Select sAMAccountName}
@cybergavin
cybergavin / rhel8-gitlab-runner.md
Last active March 28, 2021 22:26
Install GitLab Runner on RHEL8

Installed from rpm rather than binary due to the following advantages:

  • User gitlab-runner automatically created

  • gitlab-runner automatically installed as a service and enabled

    sudo dnf install -y git
    curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64.rpm"
    

sudo rpm -ivh gitlab-runner_amd64.rpm

@cybergavin
cybergavin / update-ca-rhel8.md
Created March 28, 2021 22:55
Add CA Cert to Trust store

Add new CA cert - ca-certificates package must be installed

  sudo cp <ca.crt> /usr/share/pki/ca-trust-source/anchors/

sudo update-ca-trust

@cybergavin
cybergavin / Upgrade_Az_LB.md
Created March 30, 2021 01:13
Az-LB-Upgrade

Upgrade Azure Load Balancer from Basic to Standards

  Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
  Connect-AzAccount -UseDeviceAuthentication
  Set-AzContext -Subscription "7634gvhjhjg76r83432rfefe"
  vi AzurePublicLBUpgrade.ps1 # Create script

.\AzurePublicLBUpgrade.ps1 -oldRgName "old-rg" -oldLBName "basic-lb" -newLbName "std-lb"