diff --git a/README.md b/README.md index 5698eba..d64b94e 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,10 @@ class { 'elastic_stack::repo': base_repo_url => 'https://mymirror.example.org/elastic-artifacts/packages', } ``` + +To use only specific architecture of the repo, set `architecture`, eg.: +``` puppet +class { 'elastic_stack::repo': + architecture => 'amd64', +} +``` diff --git a/manifests/repo.pp b/manifests/repo.pp index 774291c..b18f5bf 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -11,6 +11,7 @@ # @param proxy The URL of a HTTP proxy to use for package downloads (YUM only) # @param version The (major) version of the Elastic Stack for which to configure the repo # @param base_repo_url The base url for the repo path +# @param architecure The architecture to be used by apt::source class elastic_stack::repo ( Boolean $oss = false, Boolean $prerelease = false, @@ -18,6 +19,7 @@ String $proxy = 'absent', Integer $version = 7, Optional[String] $base_repo_url = undef, + Optional[String] $architecture = undef, ) { if $prerelease { $version_suffix = '.x-prerelease' @@ -69,20 +71,21 @@ include apt apt::source { 'elastic': - ensure => 'present', - comment => $description, - location => $base_url, - release => 'stable', - repos => 'main', - key => { + ensure => 'present', + comment => $description, + location => $base_url, + architecture => $architecture, + release => 'stable', + repos => 'main', + key => { 'id' => $key_id, 'source' => $key_source, }, - include => { + include => { 'deb' => true, 'src' => false, }, - pin => $priority, + pin => $priority, } } 'RedHat', 'Linux': { diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index 409c4fd..bd61e51 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -148,6 +148,15 @@ def declare_zypper(version: '7.x', **params) end end + context 'with architecture parameter' do + let(:params) { default_params.merge(architecture: 'amd64') } + + case facts[:os]['family'] + when 'Debian' + it { is_expected.to declare_apt(architecture: 'amd64') } + end + end + context 'with proxy parameter' do let(:params) { default_params.merge(proxy: 'http://proxy.com:8080') }