Revision 71ef0436
Added by Tomer Brisker over 7 years ago
manifests/plugin/ansible.pp | ||
---|---|---|
validate_absolute_path($working_dir)
|
||
}
|
||
|
||
file {"${::foreman_proxy::dir}/.ansible.cfg":
|
||
ensure => file,
|
||
content => template('foreman_proxy/plugin/ansible.cfg.erb'),
|
||
owner => 'root',
|
||
group => $::foreman_proxy::user,
|
||
mode => '0640',
|
||
}
|
||
|
||
include ::foreman_proxy::plugin::dynflow
|
||
|
||
foreman_proxy::plugin { 'ansible':
|
manifests/plugin/ansible/params.pp | ||
---|---|---|
$enabled = true
|
||
$listen_on = 'https'
|
||
$ansible_dir = '/etc/ansible'
|
||
$working_dir = undef
|
||
$working_dir = '/tmp'
|
||
}
|
spec/classes/foreman_proxy__plugin__ansible_spec.rb | ||
---|---|---|
with_content(/:enabled: https/).
|
||
with_content(%r{:ansible_dir: /etc/ansible})
|
||
end
|
||
|
||
it 'should configure ansible.cfg' do
|
||
should contain_file('/usr/share/foreman-proxy/.ansible.cfg').
|
||
with_content(%r{[default]}).
|
||
with_content(%r{callback_whitelist = foreman}).
|
||
with_content(%r{local_tmp = /tmp})
|
||
end
|
||
end
|
||
|
||
describe 'with override parameters' do
|
||
... | ... | |
{
|
||
:enabled => true,
|
||
:ansible_dir => '/etc/ansible-test',
|
||
:working_dir => '/tmp'
|
||
:working_dir => '/tmp/ansible'
|
||
}
|
||
end
|
||
|
||
... | ... | |
should contain_file('/etc/foreman-proxy/settings.d/ansible.yml').
|
||
with_content(/:enabled: https/).
|
||
with_content(%r{:ansible_dir: /etc/ansible-test}).
|
||
with_content(%r{:working_dir: /tmp})
|
||
with_content(%r{:working_dir: /tmp/ansible})
|
||
end
|
||
|
||
it 'should configure ansible.cfg' do
|
||
should contain_file('/usr/share/foreman-proxy/.ansible.cfg').
|
||
with_content(%r{[default]}).
|
||
with_content(%r{callback_whitelist = foreman}).
|
||
with_content(%r{local_tmp = /tmp/ansible})
|
||
end
|
||
end
|
||
end
|
templates/plugin/ansible.cfg.erb | ||
---|---|---|
[defaults]
|
||
callback_whitelist = foreman
|
||
local_tmp = <%= @working_dir %>
|
Also available in: Unified diff
Configure ansible for smart_proxy_ansible
If the ansible proxy plugin is installed, this will make sure that
ansible is configured to use the foreman callback plugin.