Skip to content

Commit e8efb1e

Browse files
committed
Add parameters to ensure OpenSCAP Ansible module state
Ansible equivalent of fa6a515.
1 parent e398f8c commit e8efb1e

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

examples/openscap.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include foreman_proxy
22
class { 'foreman_proxy::plugin::openscap':
3-
puppet_module => true,
3+
ansible_module => true,
4+
puppet_module => true,
45
}

manifests/plugin/openscap.pp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#
2626
# $timeout:: Timeout for sending ARF reports to foreman
2727
#
28+
# $ansible_module:: Ensure the Ansible module
29+
#
2830
# $puppet_module:: Ensure the Puppet module. This only makes sense if Puppetserver runs on the same machine.
2931
#
3032
# === Advanced parameters:
@@ -36,6 +38,8 @@
3638
# $version:: plugin package version, it's passed to ensure parameter of package resource
3739
# can be set to specific version number, 'latest', 'present' etc.
3840
#
41+
# $ansible_module_ensure:: The state of the Ansible module to ensure
42+
#
3943
# $puppet_module_ensure:: The state of the Puppet module to ensure
4044
#
4145
class foreman_proxy::plugin::openscap (
@@ -50,6 +54,8 @@
5054
Stdlib::Absolutepath $corrupted_dir = '/var/lib/foreman-proxy/openscap/corrupted',
5155
Optional[String] $proxy_name = undef,
5256
Integer[0] $timeout = 60,
57+
Boolean $ansible_module = false,
58+
String[1] $ansible_module_ensure = 'present',
5359
Boolean $puppet_module = false,
5460
String[1] $puppet_module_ensure = 'present',
5561
) {
@@ -60,6 +66,12 @@
6066
enabled => $enabled,
6167
}
6268

69+
if $ansible_module {
70+
package { 'ansiblerole-foreman_scap_client':
71+
ensure => $ansible_module_ensure,
72+
}
73+
}
74+
6375
if $puppet_module {
6476
package { 'puppet-foreman_scap_client':
6577
ensure => $puppet_module_ensure,

spec/classes/foreman_proxy__plugin__openscap_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@
3535
end
3636
end
3737

38+
context 'with ansible_module' do
39+
let :params do
40+
{
41+
ansible_module: true,
42+
}
43+
end
44+
45+
it { is_expected.to compile.with_all_deps }
46+
it { is_expected.to contain_package('ansiblerole-foreman_scap_client').with_ensure('present') }
47+
end
48+
3849
context 'with puppet_module' do
3950
let :params do
4051
{

0 commit comments

Comments
 (0)