From d2c1ac055cde364db897f2fb713acf4e42d2d5d2 Mon Sep 17 00:00:00 2001 From: Jack Peterson Date: Fri, 26 Jul 2024 13:09:03 -0700 Subject: [PATCH 1/8] update dependencies for compatibility expand range of stdlib to support up through version 9. Add additional supported OS versions (I'm testing on ubuntu 24.04) w/ Puppet 8. --- metadata.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/metadata.json b/metadata.json index 72f3911..7db2d40 100644 --- a/metadata.json +++ b/metadata.json @@ -11,7 +11,7 @@ "dependencies": [ { "name": "puppetlabs-stdlib", - "version_requirement": ">=3.2.0 <7.0.0" + "version_requirement": ">=3.2.0 <10.0.0" } ], "operatingsystem_support": [ @@ -32,18 +32,21 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04" + "14.04", + "20.04", + "22.04", + "24.04" ] } ], "requirements": [ { "name": "pe", - "version_requirement": ">= 3.2.0 < 2015.4.0" + "version_requirement": ">= 3.2.0 < 2023.7.0" }, { "name": "puppet", - "version_requirement": ">= 3.4.0 < 5.0.0" + "version_requirement": ">= 3.4.0 < 9.0.0" } ] } From 926335bda93c7c1a873a34cf7c1145ed22475d8e Mon Sep 17 00:00:00 2001 From: jackdpeterson Date: Mon, 29 Jul 2024 15:50:32 -0700 Subject: [PATCH 2/8] update facts from global ::osfamily to $facts['os']['name'] --- manifests/config.pp | 2 +- manifests/install.pp | 2 +- manifests/params.pp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 2af0356..d164bf6 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -4,7 +4,7 @@ # class codedeploy::config { - case $::osfamily { + case $facts['os']['name'] { 'RedHat', 'Amazon': { file { $::codedeploy::config_location: ensure => file, diff --git a/manifests/install.pp b/manifests/install.pp index 9c2821d..e05e1f0 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -4,7 +4,7 @@ # class codedeploy::install { - case $::osfamily { + case $facts['os']['name'] { 'RedHat', 'Amazon': { package { $::codedeploy::package_name: ensure => present, diff --git a/manifests/params.pp b/manifests/params.pp index 4f0dc21..15df6da 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,7 +4,7 @@ # It sets variables according to platform. # class codedeploy::params { - case $::osfamily { + case $facts['os']['name'] { 'Debian': { $package_url = 'https://s3.amazonaws.com/aws-codedeploy-us-east-1/latest/codedeploy-agent_all.deb' $package_name = 'codedeploy-agent' From 527bf8ae0414cc476dfdbc5623224caeb6d6f990 Mon Sep 17 00:00:00 2001 From: jackdpeterson Date: Mon, 29 Jul 2024 16:42:32 -0700 Subject: [PATCH 3/8] update facts from global ::osfamily to $facts['os']['name'] --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 15df6da..244aae4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -39,7 +39,7 @@ $verbose = true } default: { - fail("${::operatingsystem} not supported") + fail("${facts['os']['name']} not supported") } } From a717f5ad621f5f1e0c2bd06428f109d9773a1ecd Mon Sep 17 00:00:00 2001 From: jackdpeterson Date: Mon, 29 Jul 2024 16:59:25 -0700 Subject: [PATCH 4/8] group debian and ubuntu together --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 244aae4..d937a0d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -5,7 +5,7 @@ # class codedeploy::params { case $facts['os']['name'] { - 'Debian': { + 'Debian', 'Ubuntu': { $package_url = 'https://s3.amazonaws.com/aws-codedeploy-us-east-1/latest/codedeploy-agent_all.deb' $package_name = 'codedeploy-agent' $service_name = 'codedeploy-agent' From 89a43804a97b75c8c90a20720e4d17673eadf141 Mon Sep 17 00:00:00 2001 From: jackdpeterson Date: Mon, 29 Jul 2024 17:15:00 -0700 Subject: [PATCH 5/8] get rid of proxy_uri --- manifests/init.pp | 1 - templates/codedeployagent.yml.erb | 1 - 2 files changed, 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 2ab1c58..54b197b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,7 +19,6 @@ $root_dir = $::codedeploy::params::root_dir, $verbose = $::codedeploy::params::verbose, $wait_between_runs = $::codedeploy::params::wait_between_runs, - $proxy_uri = $::codedeploy::params::proxy_uri, $max_revisions = $::codedeploy::params::max_revisions, ) inherits ::codedeploy::params { diff --git a/templates/codedeployagent.yml.erb b/templates/codedeployagent.yml.erb index f4365c7..d3bcd72 100644 --- a/templates/codedeployagent.yml.erb +++ b/templates/codedeployagent.yml.erb @@ -11,5 +11,4 @@ :root_dir: <%= scope['codedeploy::root_dir'] %> :verbose: <%= scope['codedeploy::verbose'] %> :wait_between_runs: <%= scope['codedeploy::wait_between_runs'] %> -:proxy_uri: <%= scope['codedeploy::proxy_uri'] %> :max_revisions: <%= scope['codedeploy::max_revisions'] %> From 4b8a0796221049e18dfda812db37f2942dbf60ca Mon Sep 17 00:00:00 2001 From: jackdpeterson Date: Mon, 29 Jul 2024 17:26:12 -0700 Subject: [PATCH 6/8] fix install script --- manifests/install.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index e05e1f0..7e204aa 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -18,8 +18,8 @@ source => $::codedeploy::package_url, } } - 'Debian': { - if ! defined(Package['awscli']) { + 'Debian', 'Ubuntu': { + if !defined(Package['awscli']) { package { 'awscli': ensure => present, } @@ -45,7 +45,7 @@ } } default: { - fail("${::operatingsystem} not supported") + fail("${facts['os']['name']} not supported") } } } From afb0332b4f7e4ae2fc64ac723f3b34b7af26d6e2 Mon Sep 17 00:00:00 2001 From: jackdpeterson Date: Mon, 5 Aug 2024 11:23:28 -0700 Subject: [PATCH 7/8] remove package dependency and instead rely on ```File['/usr/local/bin/aws']``` being defined. --- README.markdown | 5 +++++ manifests/install.pp | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.markdown b/README.markdown index bb7498c..7c82271 100644 --- a/README.markdown +++ b/README.markdown @@ -15,6 +15,11 @@ This module installs and enables the AWS CodeDeploy agent. + +## IMPORTANT + +You must manually define `File['/usr/local/bin/aws']` in your upstream project somewhere. + ## Module Description The AWS Codedeploy allows you to automatically deploy applications to AWS instances from S3 or GitHub. This module installs any required packages followed by the CodeDeploy agent. It then enables the codedeploy-agent service and ensures that it is running. diff --git a/manifests/install.pp b/manifests/install.pp index 7e204aa..5a49ead 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -19,16 +19,11 @@ } } 'Debian', 'Ubuntu': { - if !defined(Package['awscli']) { - package { 'awscli': - ensure => present, - } - } exec { 'download_codedeploy_installer': command => '/usr/bin/aws s3 cp s3://aws-codedeploy-us-east-1/latest/install . --region us-east-1', cwd => '/tmp', creates => '/tmp/install', - require => Package['awscli'], + require => File['/usr/local/bin/aws'], } file { '/tmp/install': ensure => file, From 231487a025fa277e2097c09ba8f7d4bc1b891d20 Mon Sep 17 00:00:00 2001 From: jackdpeterson Date: Mon, 5 Aug 2024 14:14:08 -0700 Subject: [PATCH 8/8] support /usr/bin/aws and /usr/local/bin/aws possible executable paths --- manifests/install.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index 5a49ead..a36363c 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -20,9 +20,10 @@ } 'Debian', 'Ubuntu': { exec { 'download_codedeploy_installer': - command => '/usr/bin/aws s3 cp s3://aws-codedeploy-us-east-1/latest/install . --region us-east-1', + command => 'aws s3 cp s3://aws-codedeploy-us-east-1/latest/install . --region us-east-1', cwd => '/tmp', creates => '/tmp/install', + path => ['/usr/bin', '/usr/local/bin'], require => File['/usr/local/bin/aws'], } file { '/tmp/install':