This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
################################################################################ | |
# This script will generate the necessary airgap bundles and configs for an A2HA | |
# Workstation to deploy a specific version of Automate on the FE nodes. | |
# | |
# By default this will upgrade an A2HA installation with Automate 20220310123121 which is | |
# latest version compatabile with A2HA. | |
# | |
# Installation: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id=$1 | |
profile=$2 | |
type=image # or "instance" or "volume" or "snapshot" or ... | |
regions=$(aws ec2 describe-regions --profile=$profile --output text --query 'Regions[*].RegionName') | |
for region in $regions; do | |
( | |
# need to test length of the return as it might have been deleted from the region | |
test $(aws ec2 describe-${type}s --profile=$profile --region $region --$type-ids $id | jq ".Images | length") -gt 0 && | |
echo "$id is in $region" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place this file in ~/.chef/plugins/knife/ruby_version.rb | |
# Run by calling `knife ruby_version` | |
require 'chef/knife' | |
module RubyVersion | |
class RubyVersion < Chef::Knife | |
banner "knife ruby_version" | |
def run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"action": "*", | |
"resource": "*", | |
"subjects": [ | |
"team:ldap:ldap-admins-group" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomRebootHelper | |
include Chef::DSL::RebootPending | |
attr_accessor :node | |
def initialize(node) | |
@node = node | |
end | |
end | |
Chef.event_handler do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id=$1 | |
profile=$2 | |
type=image # or "instance" or "volume" or "snapshot" or ... | |
regions=$(aws ec2 describe-regions --profile=$profile --output text --query 'Regions[*].RegionName') | |
for region in $regions; do | |
( | |
aws ec2 describe-${type}s --profile=$profile --region $region --$type-ids $id &>/dev/null && | |
echo "$id is in $region" | |
) & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2018-11-21T01:42:49+00:00] ERROR: Object does not exist on remote server. | |
[2018-11-21T01:42:49+00:00] ERROR: Received HTTP error 404 | |
[2018-11-21T01:42:49+00:00] ERROR: Report handler Chef::Handler::AuditReport raised #<RuntimeError: Unable to find requested profile on path: '/compliance/organizations/support/owners/admin/compliance/badprofile/tar' on the Automate system.> | |
[2018-11-21T01:42:49+00:00] ERROR: /var/chef/cache/cookbooks/audit/files/default/vendor/chef-server/fetcher.rb:102:in `download_archive_to_temp' | |
[2018-11-21T01:42:49+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/inspec-core-2.2.102/lib/fetchers/url.rb:144:in `temp_archive_path' | |
[2018-11-21T01:42:49+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/inspec-core-2.2.102/lib/fetchers/url.rb:124:in `sha256' | |
[2018-11-21T01:42:49+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/inspec-core-2.2.102/lib/bundles/inspec-compliance/target.rb:30:in `sha256' | |
[2018-11-21T01:42:49+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):034:0> a = "\x91" # Windows-1252 hex code for curly quote | |
=> "\x91" | |
irb(main):035:0> puts a | |
� | |
=> nil | |
irb(main):036:0> puts a.valid_encoding? | |
false | |
=> nil | |
irb(main):037:0> puts a.force_encoding('Windows-1252') | |
� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/delivery/embedded/bin/ruby | |
# Usage: | |
# 1. download this file as automate_compare_status.rb | |
# 2. make it executable `chmod u+x find_missing_compliance_nodes.rb` | |
# 3. run the report `./find_missing_compliance_nodes.rb > missing_nodes_report.txt` | |
# | |
# This will print information to the console about the number of nodes found and | |
# how many are missing. It will filter out all nodes that doesn't have the | |
# wgb_audit::default recipe. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/delivery/embedded/bin/ruby | |
require 'json' | |
require 'pp' | |
days = ARGV.first | |
days ||= 3 | |
STDERR.puts "Fetching #{days} days of compliance indices" | |
all_indices = JSON.parse(`curl -s -k -XGET 'localhost:9200/_cat/indices?format=json'`) |
NewerOlder