Skip to content

Commit

Permalink
Merge pull request #203 from lorengordon/cwa-updates
Browse files Browse the repository at this point in the history
Updates cloudwatch agent install to be fully non-interactive
  • Loading branch information
lorengordon authored Apr 22, 2019
2 parents a1c00a0 + 675cbc8 commit 923f2c4
Show file tree
Hide file tree
Showing 33 changed files with 290 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.3.0
current_version = 0.3.1
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# see http://editorconfig.org
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8

[.bumpversion.cfg]
indent_style = tab

[*.yml]
indent_size = 2

[*.yaml]
indent_size = 2
118 changes: 118 additions & 0 deletions psmodules/P3Utils/P3Utils.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#
# Module manifest for module 'P3RemoteAccess'
#

@{

# Script module or binary module file associated with this manifest.
RootModule = 'P3Utils.psm1'

# Version number of this module.
ModuleVersion = '1.0'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = 'a4000f16-e896-4c48-bf7c-922db0de2063'

# Author of this module
Author = 'Plus3 IT Systems'

# Company or vendor of this module
CompanyName = 'Plus3 IT Systems'

# Copyright statement for this module
Copyright = '(c) 2019 Maintainers of plus3it/cfn. All rights reserved.'

# Description of the functionality provided by this module
# Description = ''

# Minimum version of the Windows PowerShell engine required by this module
# PowerShellVersion = ''

# Name of the Windows PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the Windows PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# CLRVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @()

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()

# A URL to the license for this module.
# LicenseUri = ''

# A URL to the main website for this project.
# ProjectUri = ''

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}
80 changes: 80 additions & 0 deletions psmodules/P3Utils/P3Utils.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
function global:Invoke-RetryCommand {
Param(
[Parameter(Mandatory=$true)]
[string]
$Command,

[Parameter(Mandatory=$false)]
$ArgList = @{},

[Parameter(Mandatory=$false)]
[string]
$CheckExpression = '$? -and $Return.Result',

[Parameter(Mandatory=$false)]
[int]
$Tries = 5,

[Parameter(Mandatory=$false)]
[int]
$InitialDelay = 2, # in seconds

[Parameter(Mandatory=$false)]
[int]
$MaxDelay = 32 # in seconds
)
Begin {
$TryCount = 0
$Delay = $InitialDelay
$Completed = $false
$MsgFailed = "Command FAILED: {0}" -f $Command
$MsgSucceeded = "Command SUCCEEDED: {0}" -f $Command
$ArgString = if ($ArgList -is [Hashtable]) { $ArgList | Select-Object -Property * | Out-String } else { $ArgList -join " "}
$Return = @{Result=$Null}

Write-Verbose ("Tries: {0}" -f $Tries)
Write-Verbose ("Command: {0}" -f $Command)
Write-Verbose ("ArgList: {0}" -f $ArgString)
}
Process {
while (-not $Completed)
{
try
{
$Return.Result = & $Command @ArgList
if (-not (Invoke-Expression $CheckExpression))
{
throw $MsgFailed
}
else
{
Write-Verbose $MsgSucceeded
Write-Output $Return.Result
$Completed = $true
}
}
catch
{
$TryCount++
if ($TryCount -ge $Tries)
{
$Completed = $true
Write-Output $Return.Result
Write-Warning ($PSItem | Select-Object -Property * | Out-String)
Write-Warning ("Command failed the maximum number of {0} time(s)." -f $Tries)
$PSCmdlet.ThrowTerminatingError($PSItem)
}
else
{
$Msg = $PSItem.ToString()
if ($Msg -ne $MsgFailed) { Write-Warning $Msg }
Write-Warning ("Command failed. Retrying in {0} second(s)." -f $Delay)
Start-Sleep $Delay
$Delay *= 2
$Delay = [Math]::Min($MaxDelay, $Delay)
}
}
}
}
End {}
}
2 changes: 1 addition & 1 deletion templates/db_mssql_alwayson.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
}
}
},
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"MssqlNode1InstanceId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This template deploys a MySQL RDS instance",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"JDBCConnectionString": {
Expand Down
2 changes: 1 addition & 1 deletion templates/ds_ad_primary_dc.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
},
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"DomainAdmin": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This element creates a Route53 private hosted zone, to resolve the domain to the AD Domain Controllers via DHCP.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"HostedZoneId": {
Expand Down
2 changes: 1 addition & 1 deletion templates/ds_ad_replica_dc.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
},
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"DomainControllerID": {
Expand Down
2 changes: 1 addition & 1 deletion templates/ds_ad_security_groups.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This element creates 2 security groups for an Active Directory domain -- one for Domain Controllers and one for Domain Members.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"DomainControllerSGID": {
Expand Down
2 changes: 1 addition & 1 deletion templates/ds_dhcp_options.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This element creates an Active Directory domain with a single domain controller. The default Domain Administrator password will be the one retrieved from the instance.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Parameters": {
"DomainControllerIPs": {
Expand Down
2 changes: 1 addition & 1 deletion templates/ds_singleaz_ad.compound.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This template creates an Active Directory infrastructure in a Single AZ.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"DomainAdmin": {
Expand Down
2 changes: 1 addition & 1 deletion templates/es_service_domain.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
]
},
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"DedicatedMasterCount": {
Expand Down
2 changes: 1 addition & 1 deletion templates/nw_create_peer_role.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This template creates an assumable role for cross account VPC peering.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"RoleARN": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
}
]
},
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"InternetGatewayId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
}
]
},
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"InternetGatewayId": {
Expand Down
2 changes: 1 addition & 1 deletion templates/nw_nat_gateway.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This element creates a NAT Gateway with an Elastic IP, Private route table with route to the NAT Gateway.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"NATGatewayElasticIP": {
Expand Down
2 changes: 1 addition & 1 deletion templates/nw_nat_with_eni.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
},
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"NATElasticNetworkInterfaceId": {
Expand Down
2 changes: 1 addition & 1 deletion templates/nw_peered_sg.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This element creates a Security Group to allow remote access from instances in the specified security group within the peered account.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"VpcPeerSecurityGroupId": {
Expand Down
2 changes: 1 addition & 1 deletion templates/nw_private_subnet.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This element creates a Private Subnet and associates it with a given Route Table.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"AvailabilityZoneName": {
Expand Down
2 changes: 1 addition & 1 deletion templates/nw_public_subnet.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This element creates a Public Subnet and associates it with a given Route Table.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"AvailabilityZoneName": {
Expand Down
2 changes: 1 addition & 1 deletion templates/nw_r53_peered_domain.element.template.cfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This element creates a Route53 Private Hosted Zone and the associated resource records for a peered domain.",
"Metadata": {
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"PrivateHostedZoneId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
}
]
},
"Version": "0.3.0"
"Version": "0.3.1"
},
"Outputs": {
"InternetGatewayId": {
Expand Down
Loading

0 comments on commit 923f2c4

Please sign in to comment.