Skip to content

Commit

Permalink
Merge pull request #68 from stahnma/epelfix
Browse files Browse the repository at this point in the history
Add options to disable repo resources when desired
  • Loading branch information
rnelson0 authored Oct 23, 2017
2 parents df5697e + 0531572 commit a1fef5c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Other repositories that will setup but disabled (as per the epel-release setup)

In nearly all cases, you can simply _include epel_ or classify your nodes with
the epel class. There are quite a few parameters available if you need to modify
the default settings for the epel repository such having your own mirror, an
http proxy, disable gpg checking.
the default settings for the epel repository such as having your own mirror, an
http proxy, or disable gpg checking.

You can also use a puppet one-liner to get epel onto a system.

Expand Down
31 changes: 27 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$epel_proxy = $epel::params::epel_proxy,
$epel_enabled = $epel::params::epel_enabled,
$epel_gpgcheck = $epel::params::epel_gpgcheck,
$epel_managed = $epel::params::epel_managed,
$epel_exclude = undef,
$epel_includepkgs = undef,
$epel_sslclientkey = undef,
Expand All @@ -27,6 +28,7 @@
$epel_testing_proxy = $epel::params::epel_testing_proxy,
$epel_testing_enabled = $epel::params::epel_testing_enabled,
$epel_testing_gpgcheck = $epel::params::epel_testing_gpgcheck,
$epel_testing_managed = $epel::params::epel_testing_managed,
$epel_testing_exclude = undef,
$epel_testing_includepkgs = undef,
$epel_testing_sslclientkey = undef,
Expand All @@ -37,6 +39,7 @@
$epel_source_proxy = $epel::params::epel_source_proxy,
$epel_source_enabled = $epel::params::epel_source_enabled,
$epel_source_gpgcheck = $epel::params::epel_source_gpgcheck,
$epel_source_managed = $epel::params::epel_source_managed,
$epel_source_exclude = undef,
$epel_source_includepkgs = undef,
$epel_source_sslclientkey = undef,
Expand All @@ -47,6 +50,7 @@
$epel_debuginfo_proxy = $epel::params::epel_debuginfo_proxy,
$epel_debuginfo_enabled = $epel::params::epel_debuginfo_enabled,
$epel_debuginfo_gpgcheck = $epel::params::epel_debuginfo_gpgcheck,
$epel_debuginfo_managed = $epel::params::epel_debuginfo_managed,
$epel_debuginfo_exclude = undef,
$epel_debuginfo_includepkgs = undef,
$epel_debuginfo_sslclientkey = undef,
Expand All @@ -57,6 +61,7 @@
$epel_testing_source_proxy = $epel::params::epel_testing_source_proxy,
$epel_testing_source_enabled = $epel::params::epel_testing_source_enabled,
$epel_testing_source_gpgcheck = $epel::params::epel_testing_source_gpgcheck,
$epel_testing_source_managed = $epel::params::epel_testing_source_managed,
$epel_testing_source_exclude = undef,
$epel_testing_source_includepkgs = undef,
$epel_testing_source_sslclientkey = undef,
Expand All @@ -67,14 +72,19 @@
$epel_testing_debuginfo_proxy = $epel::params::epel_testing_debuginfo_proxy,
$epel_testing_debuginfo_enabled = $epel::params::epel_testing_debuginfo_enabled,
$epel_testing_debuginfo_gpgcheck = $epel::params::epel_testing_debuginfo_gpgcheck,
$epel_testing_debuginfo_managed = $epel::params::epel_testing_debuginfo_managed,
$epel_testing_debuginfo_exclude = undef,
$epel_testing_debuginfo_includepkgs = undef,
$epel_testing_debuginfo_sslclientkey = undef,
$epel_testing_debuginfo_sslclientcert = undef,
$epel_gpg_managed = $epel::params::epel_gpg_managed,
$os_maj_release = $epel::params::os_maj_release,
) inherits epel::params {

Epel::Rpm_gpg_key <| |> -> Yumrepo <| |>

if "${::osfamily}" == 'RedHat' and "${::operatingsystem}" !~ /Fedora|Amazon/ { # lint:ignore:only_variable_string
if $epel_testing_managed {
yumrepo { 'epel-testing':
# lint:ignore:selector_inside_resource
mirrorlist => $epel_testing_baseurl ? {
Expand All @@ -94,7 +104,9 @@
sslclientkey => $epel_testing_sslclientkey,
sslclientcert => $epel_testing_sslclientcert,
}
}

if $epel_testing_debuginfo_managed {
yumrepo { 'epel-testing-debuginfo':
# lint:ignore:selector_inside_resource
mirrorlist => $epel_testing_debuginfo_baseurl ? {
Expand All @@ -114,7 +126,9 @@
sslclientkey => $epel_testing_debuginfo_sslclientkey,
sslclientcert => $epel_testing_debuginfo_sslclientcert,
}
}

if $epel_testing_source_managed {
yumrepo { 'epel-testing-source':
# lint:ignore:selector_inside_resource
mirrorlist => $epel_testing_source_baseurl ? {
Expand All @@ -134,7 +148,9 @@
sslclientkey => $epel_testing_source_sslclientkey,
sslclientcert => $epel_testing_source_sslclientcert,
}
}

if $epel_managed {
yumrepo { 'epel':
# lint:ignore:selector_inside_resource
mirrorlist => $epel_baseurl ? {
Expand All @@ -154,7 +170,9 @@
sslclientkey => $epel_sslclientkey,
sslclientcert => $epel_sslclientcert,
}
}

if $epel_debuginfo_managed {
yumrepo { 'epel-debuginfo':
# lint:ignore:selector_inside_resource
mirrorlist => $epel_debuginfo_baseurl ? {
Expand All @@ -174,7 +192,9 @@
sslclientkey => $epel_debuginfo_sslclientkey,
sslclientcert => $epel_debuginfo_sslclientcert,
}
}

if $epel_source_managed {
yumrepo { 'epel-source':
# lint:ignore:selector_inside_resource
mirrorlist => $epel_source_baseurl ? {
Expand All @@ -194,10 +214,11 @@
sslclientkey => $epel_source_sslclientkey,
sslclientcert => $epel_source_sslclientcert,
}
}

# ERB template used here to ensure file content is in the Puppet catalog;
# nothing is interpolated in these templates.

# ERB template used here to ensure file content is in the Puppet catalog;
# nothing is interpolated in these templates.
if $epel_gpg_managed {
file { "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${os_maj_release}":
ensure => present,
owner => 'root',
Expand All @@ -208,14 +229,16 @@

epel::rpm_gpg_key{ "EPEL-${os_maj_release}":
path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${os_maj_release}",
before => Yumrepo['epel','epel-source','epel-debuginfo','epel-testing','epel-testing-source','epel-testing-debuginfo'],
}
}

} elsif "${::osfamily}" == 'RedHat' and "${::operatingsystem}" == 'Amazon' { # lint:ignore:only_variable_string
if $epel_managed {
yumrepo { 'epel':
enabled => $epel_enabled,
gpgcheck => $epel_gpgcheck,
}
}
} else {
notice ("Your operating system ${::operatingsystem} will not have the EPEL repository applied")
}
Expand Down
8 changes: 7 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,39 @@
$epel_gpgcheck = '1'
$epel_testing_mirrorlist = "https://mirrors.fedoraproject.org/${url_path}?repo=testing-epel${os_maj_release}&arch=\$basearch"
$epel_testing_baseurl = 'absent'
$epel_managed = true
$epel_testing_failovermethod = 'priority'
$epel_testing_proxy = $proxy
$epel_testing_enabled = '0'
$epel_testing_gpgcheck = '1'
$epel_source_mirrorlist = "https://mirrors.fedoraproject.org/${url_path}?repo=epel-source-${os_maj_release}&arch=\$basearch"
$epel_testing_managed = true
$epel_source_baseurl = 'absent'
$epel_source_failovermethod = 'priority'
$epel_source_proxy = $proxy
$epel_source_enabled = '0'
$epel_source_gpgcheck = '1'
$epel_debuginfo_mirrorlist = "https://mirrors.fedoraproject.org/${url_path}?repo=epel-debug-${os_maj_release}&arch=\$basearch"
$epel_source_managed = true
$epel_debuginfo_baseurl = 'absent'
$epel_debuginfo_failovermethod = 'priority'
$epel_debuginfo_proxy = $proxy
$epel_debuginfo_enabled = '0'
$epel_debuginfo_gpgcheck = '1'
$epel_testing_source_mirrorlist = "https://mirrors.fedoraproject.org/${url_path}?repo=testing-source-epel${os_maj_release}&arch=\$basearch"
$epel_testing_source_baseurl = 'absent'
$epel_debuginfo_managed = true
$epel_testing_source_failovermethod = 'priority'
$epel_testing_source_proxy = $proxy
$epel_testing_source_enabled = '0'
$epel_testing_source_gpgcheck = '1'
$epel_testing_debuginfo_mirrorlist = "https://mirrors.fedoraproject.org/${url_path}?repo=testing-debug-epel${os_maj_release}&arch=\$basearch"
$epel_testing_debuginfo_baseurl = 'absent'
$epel_testing_source_managed = true
$epel_testing_debuginfo_failovermethod = 'priority'
$epel_testing_debuginfo_proxy = $proxy
$epel_testing_debuginfo_enabled = '0'
$epel_testing_debuginfo_gpgcheck = '1'

$epel_testing_debuginfo_managed = true
$epel_gpg_managed = true
}

0 comments on commit a1fef5c

Please sign in to comment.