ansible: allow configuring default_* configuration parameters
Change-Id: Icf3304b6d47eb13f2cd214d385d714b6287d6828 Depends-On: Ib198c07c1d414c0d78950e5d98a5176e12a7df13 Closes-Bug: #1736409
This commit is contained in:
parent
3d1bea1800
commit
ca56d8237a
@ -35,13 +35,46 @@
|
||||
# downloading the image.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*default_username*]
|
||||
# (optional) Default name of the user to use for Ansible when connecting to
|
||||
# the ramdisk over SSH.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*default_key_file*]
|
||||
# (optional) Absolute path to the private SSH key file to use by Ansible
|
||||
# by default when connecting to the ramdisk over SSH.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*default_deploy_playbook*]
|
||||
# (optional) Path to the default playbook used for deployment.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*default_shutdown_playbook*]
|
||||
# (optional) Path to the default playbook used for graceful shutdown.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*default_clean_playbook*]
|
||||
# (optional) Path to the default playbook used for cleaning.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*default_clean_steps_config*]
|
||||
# (optional) Path to the default auxiliary cleaning steps file used during
|
||||
# cleaning.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
|
||||
class ironic::drivers::ansible (
|
||||
$package_ensure = 'present',
|
||||
$ansible_extra_args = $::os_service_default,
|
||||
$playbooks_path = $::os_service_default,
|
||||
$config_file_path = $::os_service_default,
|
||||
$image_store_insecure = $::os_service_default,
|
||||
$package_ensure = 'present',
|
||||
$ansible_extra_args = $::os_service_default,
|
||||
$playbooks_path = $::os_service_default,
|
||||
$config_file_path = $::os_service_default,
|
||||
$image_store_insecure = $::os_service_default,
|
||||
$default_username = $::os_service_default,
|
||||
$default_key_file = $::os_service_default,
|
||||
$default_deploy_playbook = $::os_service_default,
|
||||
$default_shutdown_playbook = $::os_service_default,
|
||||
$default_clean_playbook = $::os_service_default,
|
||||
$default_clean_steps_config = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::ironic::deps
|
||||
@ -49,10 +82,16 @@ class ironic::drivers::ansible (
|
||||
|
||||
# Configure ironic.conf
|
||||
ironic_config {
|
||||
'ansible/ansible_extra_args': value => $ansible_extra_args;
|
||||
'ansible/playbooks_path': value => $playbooks_path;
|
||||
'ansible/config_file_path': value => $config_file_path;
|
||||
'ansible/image_store_insecure': value => $image_store_insecure;
|
||||
'ansible/ansible_extra_args': value => $ansible_extra_args;
|
||||
'ansible/playbooks_path': value => $playbooks_path;
|
||||
'ansible/config_file_path': value => $config_file_path;
|
||||
'ansible/image_store_insecure': value => $image_store_insecure;
|
||||
'ansible/default_username': value => $default_username;
|
||||
'ansible/default_key_file': value => $default_key_file;
|
||||
'ansible/default_deploy_playbook': value => $default_deploy_playbook;
|
||||
'ansible/default_shutdown_playbook': value => $default_shutdown_playbook;
|
||||
'ansible/default_clean_playbook': value => $default_clean_playbook;
|
||||
'ansible/default_clean_steps_config': value => $default_clean_steps_config;
|
||||
}
|
||||
|
||||
ensure_packages('ansible',
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Allow configuring the defaults for the ansible deploy interface via new
|
||||
parameters ``default_username``, ``default_key_file``,
|
||||
``default_deploy_playbook``, ``default_shutdown_playbook``,
|
||||
``default_clean_playbook`` and ``default_clean_steps_config`` in the
|
||||
``ironic::drivers::ansible`` manifest.
|
@ -31,6 +31,12 @@ describe 'ironic::drivers::ansible' do
|
||||
is_expected.to contain_ironic_config('ansible/playbooks_path').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('ansible/config_file_path').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('ansible/image_store_insecure').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('ansible/default_username').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('ansible/default_key_file').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('ansible/default_deploy_playbook').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('ansible/default_shutdown_playbook').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('ansible/default_clean_playbook').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('ansible/default_clean_steps_config').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
it 'installs ansible package' do
|
||||
@ -51,13 +57,25 @@ describe 'ironic::drivers::ansible' do
|
||||
params.merge!(:ansible_extra_args => '--foo',
|
||||
:playbooks_path => '/home/stack/playbooks',
|
||||
:config_file_path => '/home/stack/ansible.cfg',
|
||||
:image_store_insecure => true)
|
||||
:image_store_insecure => true,
|
||||
:default_username => 'root',
|
||||
:default_key_file => '/etc/ironic/ipa-ssh',
|
||||
:default_deploy_playbook => 'deploy-extra.yaml',
|
||||
:default_shutdown_playbook => 'shutdown-extra.yaml',
|
||||
:default_clean_playbook => 'clean-extra.yaml',
|
||||
:default_clean_steps_config => 'custom-clean-steps.yaml')
|
||||
end
|
||||
it 'should replace default parameter with new value' do
|
||||
is_expected.to contain_ironic_config('ansible/ansible_extra_args').with_value(p[:ansible_extra_args])
|
||||
is_expected.to contain_ironic_config('ansible/playbooks_path').with_value(p[:playbooks_path])
|
||||
is_expected.to contain_ironic_config('ansible/config_file_path').with_value(p[:config_file_path])
|
||||
is_expected.to contain_ironic_config('ansible/image_store_insecure').with_value(p[:image_store_insecure])
|
||||
is_expected.to contain_ironic_config('ansible/default_username').with_value(p[:default_username])
|
||||
is_expected.to contain_ironic_config('ansible/default_key_file').with_value(p[:default_key_file])
|
||||
is_expected.to contain_ironic_config('ansible/default_deploy_playbook').with_value(p[:default_deploy_playbook])
|
||||
is_expected.to contain_ironic_config('ansible/default_shutdown_playbook').with_value(p[:default_shutdown_playbook])
|
||||
is_expected.to contain_ironic_config('ansible/default_clean_playbook').with_value(p[:default_clean_playbook])
|
||||
is_expected.to contain_ironic_config('ansible/default_clean_steps_config').with_value(p[:default_clean_steps_config])
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user