Put configuration files under configurable folder
Instead of putting baremetal.json and groupvars/all on the git repo folder for Bifrost, just create a folder (which defaults to /etc/bifrost) and put those files in there. This will avoid having a dirty bifrost git repo and having issues whenever the Bifrost git repo is updated. Note, you will need to run 'ansible-playbook -e @/etc/bifrost/bifrost_global_vars ...' in order to load the configuration file variables at execution time. Check http://docs.ansible.com/ansible/playbooks_variables.html for more info. Change-Id: Id0f5711f6f4e18cf67586e2445d8bd09c5db7ca9
This commit is contained in:
parent
8855640802
commit
5baf8d135c
@ -66,6 +66,14 @@ class { '::ironic::api':
|
||||
}
|
||||
|
||||
class { '::ironic::drivers::ipmi': }
|
||||
|
||||
# alternatively, you can deploy Ironic with Bifrost. It's a collection of Ansible playbooks to configure
|
||||
# and install Ironic in a stand-alone fashion (for more information visit http://git.openstack.org/openstack/bifrost)
|
||||
class { 'ironic::bifrost':
|
||||
ironic_db_password => 'a_big_secret',
|
||||
mysql_password => 'yet_another_big_secret',
|
||||
baremetal_json_hosts => hiera('your_hiera_var_containing_bm_json_hosts'),
|
||||
}
|
||||
```
|
||||
|
||||
Examples of usage also can be found in the *examples* directory.
|
||||
|
@ -55,6 +55,15 @@
|
||||
# (optional) Folder to clone the Bifrost git repository
|
||||
# Defaults to '/opt/stack/bifrost'
|
||||
#
|
||||
# [*bifrost_config_folder*]
|
||||
# (optional) Folder to keep the configuration files, namely the global vars file
|
||||
# and baremetal.json
|
||||
# Defaults to '/etc/bifrost'
|
||||
# Note that due to how Ansible handles the directory layout of playbooks and roles,
|
||||
# you will need to pass '-e "@/etc/bifrost/bifrost_global_vars' switch to 'ansible-playbook'
|
||||
# to load the variables at execution time.
|
||||
# For more information, check http://docs.ansible.com/ansible/playbooks_variables.html
|
||||
#
|
||||
# [*ironic_url*]
|
||||
# (optional) The URL of the Ironic server
|
||||
# Defaults to '"http://localhost:6385"'
|
||||
@ -155,6 +164,7 @@ class ironic::bifrost (
|
||||
$ensure = present,
|
||||
$revision = 'master',
|
||||
$git_dest_repo_folder = '/opt/stack/bifrost',
|
||||
$bifrost_config_folder = '/etc/bifrost',
|
||||
$ironic_url = '"http://localhost:6385/"',
|
||||
$network_interface = '"virbr0"',
|
||||
$testing = false,
|
||||
@ -187,16 +197,20 @@ class ironic::bifrost (
|
||||
source => $git_source_repo,
|
||||
}
|
||||
|
||||
file { "${git_dest_repo_folder}/playbooks/inventory/group_vars/all":
|
||||
ensure => present,
|
||||
content => template('ironic/group_vars_all.erb'),
|
||||
require => Vcsrepo[$git_dest_repo_folder],
|
||||
file { $bifrost_config_folder:
|
||||
ensure => directory
|
||||
}
|
||||
|
||||
file { "${git_dest_repo_folder}/baremetal.json":
|
||||
file { "${bifrost_config_folder}/bifrost_global_vars":
|
||||
ensure => present,
|
||||
content => template('ironic/bifrost_global_vars.erb'),
|
||||
require => File[$bifrost_config_folder],
|
||||
}
|
||||
|
||||
file { "${bifrost_config_folder}/baremetal.json":
|
||||
ensure => present,
|
||||
content => template('ironic/baremetal.json.erb'),
|
||||
require => Vcsrepo[$git_dest_repo_folder],
|
||||
require => File[$bifrost_config_folder],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ describe 'ironic::bifrost' do
|
||||
{ :git_source_repo => 'https://git.openstack.org/openstack/bifrost',
|
||||
:revision => master,
|
||||
:git_dest_repo_folder => '/opt/stack/bifrost',
|
||||
:bifrost_config_folder => '/etc/bifrost',
|
||||
:ironic_url => '"http://localhost:6385/"',
|
||||
:network_interface => '"virbr0"',
|
||||
:testing => false,
|
||||
@ -65,18 +66,24 @@ describe 'ironic::bifrost' do
|
||||
)
|
||||
end
|
||||
|
||||
it 'should contain file group_vars/all' do
|
||||
should contain_file('/opt/stack/bifrost/playbooks/inventory/group_vars/all').with(
|
||||
it 'should contain folder /etc/bifrost' do
|
||||
should contain_file('/etc/bifrost').with(
|
||||
'ensure' => 'directory',
|
||||
)
|
||||
end
|
||||
|
||||
it 'should contain file /etc/bifrost/bifrost_global_vars' do
|
||||
should contain_file('/etc/bifrost/bifrost_global_vars').with(
|
||||
'ensure' => 'present',
|
||||
'require' => 'Vcsrepo[/opt/stack/bifrost]',
|
||||
'require' => 'File[/etc/bifrost]',
|
||||
'content' => /ironic_url/,
|
||||
)
|
||||
end
|
||||
|
||||
it 'should contain file baremetal.json' do
|
||||
should contain_file('/opt/stack/bifrost/baremetal.json').with(
|
||||
it 'should contain file /etc/bifrost/baremetal.json' do
|
||||
should contain_file('/etc/bifrost/baremetal.json').with(
|
||||
'ensure' => 'present',
|
||||
'require' => 'Vcsrepo[/opt/stack/bifrost]',
|
||||
'require' => 'File[/etc/bifrost]',
|
||||
'content' => /test/,
|
||||
)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user