Add ironic::drivers::ansible to configure the ansible deploy interface
Change-Id: I55aecb95bc3ab1264487bcda5870b6e4fc7aa787 Related: blueprint ansible-deploy Depends-On: I43f54688287953ccb1c2836437aea76236e6560b
This commit is contained in:
52
manifests/drivers/ansible.pp
Normal file
52
manifests/drivers/ansible.pp
Normal file
@@ -0,0 +1,52 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Configure the ansible deploy interface
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*ansible_extra_args*]
|
||||
# (optional) Extra arguments to pass on every invocation of ansible.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*playbooks_path*]
|
||||
# (optional) Path to directory with playbooks, roles and local inventory.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*config_file_path*]
|
||||
# (optional) Path to ansible configuration file.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*image_store_insecure*]
|
||||
# (optional) Skip verifying SSL connections to the image store when
|
||||
# downloading the image.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
|
||||
class ironic::drivers::ansible (
|
||||
$ansible_extra_args = $::os_service_default,
|
||||
$playbooks_path = $::os_service_default,
|
||||
$config_file_path = $::os_service_default,
|
||||
$image_store_insecure = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::ironic::deps
|
||||
|
||||
# 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;
|
||||
}
|
||||
|
||||
}
|
||||
5
releasenotes/notes/ansible-deploy-b6c4fa172efe30fb.yaml
Normal file
5
releasenotes/notes/ansible-deploy-b6c4fa172efe30fb.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Added manifest ``ironic::drivers::ansible`` to configure the new ansible
|
||||
deploy interface.
|
||||
64
spec/classes/ironic_drivers_ansible_spec.rb
Normal file
64
spec/classes/ironic_drivers_ansible_spec.rb
Normal file
@@ -0,0 +1,64 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Unit tests for ironic::drivers::agent class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ironic::drivers::ansible' do
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples_for 'ironic ansible deploy interface' do
|
||||
let :p do
|
||||
params
|
||||
end
|
||||
|
||||
it 'configures ironic.conf' do
|
||||
is_expected.to contain_ironic_config('ansible/ansible_extra_args').with_value('<SERVICE DEFAULT>')
|
||||
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>')
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
before do
|
||||
params.merge!(:ansible_extra_args => '--foo',
|
||||
:playbooks_path => '/home/stack/playbooks',
|
||||
:config_file_path => '/home/stack/ansible.cfg',
|
||||
:image_store_insecure => true)
|
||||
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])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts())
|
||||
end
|
||||
it_behaves_like 'ironic ansible deploy interface'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user