cookbook 'opennebula_ng', '~> 5.1.0'
opennebula_ng (14) Versions 5.1.0 Follow0
Installs/Configures opennebula_ng
cookbook 'opennebula_ng', '~> 5.1.0', :supermarket
knife supermarket install opennebula_ng
knife supermarket download opennebula_ng
opennebula_ng cookbook
Official repository for the opennebula_ng
cookbook, a cookbook for managing OpenNebula
via the Chef configuration management tool.
Supported Platforms
- Debian
- Ubuntu
Quickstart
To setup a minimal configuration, standalone OpenNebula server, set the following attributes to configure your network
node['opennebula_ng']['interfaces']['br0']['inet']['type'] = 'inet' node['opennebula_ng']['interfaces']['br0']['inet']['address'] = '192.168.1.100' node['opennebula_ng']['interfaces']['br0']['inet']['network'] = '192.168.1.0' node['opennebula_ng']['interfaces']['br0']['inet']['netmask'] = '255.255.255.0' node['opennebula_ng']['interfaces']['br0']['inet']['broadcast'] = '192.168.1.255' node['opennebula_ng']['interfaces']['br0']['inet']['gateway'] = '192.168.1.1'
And run the following recipes:
- default
- sunstone
- node
- register_nodes
This will do the following things
- Install the Sunstone frontend
- Configure the network, add OpenNebula bridge
- Register the current host as an OpenNebula node
You should be able to connect to your new OpenNebula installation using http://yourhost.com:9869
Recipes
default
The default recipe just includes the apt_repository
recipe
apt_repository
This recipe sets up the official OpenNebula PPA for Ubuntu (stable)
You may override the specified version by manually setting node['opennebula_ng']['version']
addon_lvm
This recipe installs the official OpenNebula LVM addon, which is not part of OpenNebula core since version 5.0
If you are using LVM block devices using the lvm
driver, you're going to need this.
By default it installs the addon from the official git repository, as there are no tarball releases yet. The repository, as well as the branch (defaults to master
) can be overriden using the following attributes:
node['opennebula_ng']['lvm']['repository'] = 'https://github.com/OpenNebula/addon-lvm' node['opennebula_ng']['lvm']['branch'] = 'master'
sunstone
This recipe installs and configures the sunstone frontend.
- Installs opennebula and opennebula-sunstone packages
- Takes care of SSH and authorized_keys configuration
node
This recipe turns your machine into an opennebula node
- Configures networking according to node attributes (DANGER: touches
/etc/network/interfaces
) - Configures the OpenNebula bridge interface
- Configures qEMU
- Configures libvirt
MAKE SURE you configure the following attributes (e.g. create one file for each node in your
wrapper cookbooks attribute dir, e.g. attributes/myhost1.rb
)
if node.name == 'myhost1' node['opennebula_ng']['interfaces']['br0']['inet']['type'] = 'static' node['opennebula_ng']['interfaces']['br0']['inet']['address'] = '192.168.1.100' node['opennebula_ng']['interfaces']['br0']['inet']['network'] = '192.168.1.0' node['opennebula_ng']['interfaces']['br0']['inet']['netmask'] = '255.255.255.0' node['opennebula_ng']['interfaces']['br0']['inet']['broadcast'] = '192.168.1.255' node['opennebula_ng']['interfaces']['br0']['inet']['gateway'] = '192.168.1.1' node['opennebula_ng']['interfaces']['br0']['inet']['bridge_ports'] = 'eth0' node['opennebula_ng']['interfaces']['br0']['inet']['bridge_fd'] = 9 node['opennebula_ng']['interfaces']['br0']['inet']['bridge_hello'] = 2 node['opennebula_ng']['interfaces']['br0']['inet']['bridge_maxage'] = 12 node['opennebula_ng']['interfaces']['br0']['inet']['bridge_stp'] = 'off' end
You can also configure additional interfaces, if required
node['opennebula_ng']['interfaces']['br1']['inet']['type'] = 'static' node['opennebula_ng']['interfaces']['br1']['inet']['address'] = '10.0.0.100' node['opennebula_ng']['interfaces']['br1']['inet']['network'] = '10.0.0.0' node['opennebula_ng']['interfaces']['br1']['inet']['netmask'] = '255.255.255.0' node['opennebula_ng']['interfaces']['br1']['inet']['broadcast'] = '10.0.0.255' node['opennebula_ng']['interfaces']['br1']['inet']['bridge_ports'] = 'eth1' node['opennebula_ng']['interfaces']['br1']['inet']['bridge_fd'] = 9 node['opennebula_ng']['interfaces']['br1']['inet']['bridge_hello'] = 2 node['opennebula_ng']['interfaces']['br1']['inet']['bridge_maxage'] = 12 node['opennebula_ng']['interfaces']['br1']['inet']['bridge_stp'] = 'off'
Since version 4.12.1, ipv6 is also supported:
node['opennebula_ng']['interfaces']['br0']['inet6']['type'] = 'static' node['opennebula_ng']['interfaces']['br0']['inet6']['address'] = 'fcc1:cafe:bee1:dead::1' node['opennebula_ng']['interfaces']['br0']['inet6']['network'] = 64
mariadb_server
Configures OpenNebula to use a MariaDB backend.
Adjust the following attributes in case they are different from the defaults:
# Default mysql database settings node['opennebula_ng']['mysql']['server'] = 'localhost' node['opennebula_ng']['mysql']['port'] = 0 node['opennebula_ng']['mysql']['user'] = 'oneadmin' node['opennebula_ng']['mysql']['passwd'] = 'oneadmin' node['opennebula_ng']['mysql']['db_name'] = 'opennebula'
Make sure you set a root password (This password will also be used for the debian-sys-maint
user,
in case you use Debian/Ubuntu.
node['mysqld']['root_password'] = 'get_me_from_encrypted_data_bag_maybe?'
Set the wsrep ssh auth, for example, use the root user which password we just specified:
node['mysqld']['my.cnf']['mysqld']['wsrep_sst_auth'] = "root:#{node['mysqld']['root_password']}"
In case you have multiple interfaces, you might also want to specify the IP of the interface the
replication should use
node['mysqld']['my.cnf']['mysqld']['wsrep_node_address'] = 'eth1'
In case you use more than one mariadb galera node, set this attribute to include all galera nodes
in your cluster
node['mysqld']['my.cnf']['mysqld']['wsrep_cluster_address'] = 'gcomm://node1,node2,node3'
Its recommended to keep one Galera node on each physical cluster (as virtual machines), and then
default each machine to connect to the one their hosting. This can be done like this:
# Connect to different clusters if node.name == 'node1' default['opennebula_ng']['mysql']['server'] = 'galera.node.on.host1' elsif node.name == 'node2' default['opennebula_ng']['mysql']['server'] = 'galera.node.on.host2' else default['opennebula_ng']['mysql']['server'] = 'galera.node.on.host1' end
mariadb_galera_init
Use this cookbook if you want to initialize a new clusters first node:
sudo chef-client --once -o 'recipe[opennebula_ng::mariadb_galera_init]'
You can also include it (if required) in a mariadb_galera_init
cookbook in your wrapper cookbook
include_recipe 'opennebula_ng::mariadb_galera_init'
This cookbook just calls mysqld::mariadb_galera_init
. Having it here is useful, as we set some
attributes which are not available when calling the mysqld recipe directly.
mariadb_client
This recipe configures the /etc/one/oned.conf
configuration file on the servers to connect to the
mariadb cluster specified in the arguments from the mariadb_server recipe.
Note: If those values are changed, the file is not automatically updated. This is due to a bug with
multiline regular expressions. See recipes/mariadb_client.rb
for details
register_nodes
This recipe registers your hosts at oned.
The configuration is set via attributes, and supports all parameters that onehost
supports.
The default is to register the node chef is currently running on, using kvm
# You can add all your nodes centrally here node['opennebula_ng']['nodes'] = { myhost1: { im: 'kvm', vm: 'kvm', net: 'dummy' }, myhost2: { im: 'kvm', vm: 'kvm', net: 'dummy' }, myhost3: { im: 'kvm', vm: 'kvm', net: 'dummy' }, }
virtual_networks
This recipe registers virtual networks using onenet
.
You can specify your network configuration using the following attributes. Both fixed
and ranged
networks are supported.
node['opennebula_ng']['virtual_networks'] = { frontnet_dualstack: { BRIDGE: 'br0', GATEWAY: '192.168.1.1', NETWORK_MASK: '255.255.255.0', NETWORK_ADDRESS: '192.168.1.0', DNS: '208.67.222.222 208.67.220.220', AR: { TYPE: 'IP4_6', IP: '192.168.100.1', GLOBAL_PREFIX: '2a00:abcd:1000:f000::', SIZE: 100, }, }, backnet_ipv4: { BRIDGE: 'br1', NETWORK_MASK: '255.255.255.0', NETWORK_ADDRESS: '10.0.0.0', # Multiple address-ranges are also valid AR: [ { TYPE: 'IP4', IP: '10.0.0.100', SIZE: 10, }, { TYPE: 'IP4', IP: '192.168.1.0', SIZE: 10, }, ], }, }
Note: If you later add more addresses to an existing network, the settings are not automatically
updated on the nodes. The recipe skips creating a network if the network already exists.
lvm
A recipe to configure LVM datastores.
- Installs and configures lvm packages
- Creates datastores according to attributes
You can configure the datastores using the following attributes:
node['opennebula_ng']['lvm']['datastores'] = { 'my datastore' => { DS_MAD: 'lvm', TM_MAD: 'lvm', DISK_TYPE: 'BLOCK', VG_NAME: 'vg-one', BRIDGE_LIST: node['hostname'], # Add all hostnames of hosts accessing this datastore } }
nfs_server
This recipe configures the host to be a NFS server. It can be configured using the following
attributes:
# Network to export NFS directories to, defaults to all hosts node['opennebula_ng']['nfs']['network'] = '*' # or a network like e.g. '10.0.0.0/24' # NFS fsid. Must be unique node['opennebula_ng']['nfs']['fsid'] = 1 # Hostname/IP of the NFS server (usually the frontend machine) node['opennebula_ng']['nfs']['server'] = 'myhost1'
nfs_client
Configures the host to be an NFS client, mouting /var/lib/one
from the server stored in
node['opennebula_ng']['nfs']['server']
one_auth
Configures the auth tokens in /var/lib/one/.one
. When using a shared database, but not a shared
/var/lib/one/.one
directory, they need to be in sync between all servers.
You can set the shared items using the following attributes:
# Set shared passwords between all opennebula hosts for serveradmin and oneadmin node['opennebula_ng']['one_auth']['oneadmin']['password'] = 'password_from_encrypted_data_bag_maybe?' node['opennebula_ng']['one_auth']['serveradmin']['password'] = 'another_password'
You can also set the ssh keypair (as every OpenNebula host needs to be able to connect to the
others, using the "oneadmin" user).
Hint: You can generate a keypair using the ssh-keygen
command.
node['opennebula_ng']['one_auth']['oneadmin']['id_rsa'] = "-----BEGIN RSA PRIVATE KEY-----\nMIIE..." node['opennebula_ng']['one_auth']['oneadmin']['id_rsa.pub'] = 'ssh-rsa AAAA...'
NOTE: This recipe assumes that the oneuser has id 0, and serveradmin the id 1. This is the default.
If you have them set to something else, make sure to adjust the id attributes!
node['opennebula_ng']['one_auth']['oneadmin']['id'] = 0 node['opennebula_ng']['one_auth']['serveradmin']['id'] = 1
You can also configure (if needed) the oneadmin's home directory as well as the one_auth
file that
will be used:
node['opennebula_ng']['one_auth']['oneadmin']['home'] = '/var/lib/one' node['opennebula_ng']['one_auth']['oneadmin']['auth_file'] = '/var/lib/one/.one/one_auth'
Notes
Please be aware, that you probably want a reverse proxy like nginx incl. SSL
before you deploy OpenNebula to your production servers.
You can easily do this e.g. using the
certificate and
nginx cookbooks.
Contributing
- Fork the repository on Github
- Create a named feature branch (i.e.
add-new-recipe
) - Write you change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request
License
Author: | Chris Aumann (me@chr4.org) |
Copyright: | Copyright (c) 2015 Chris Aumann |
License: | GNU Public License 3.0 |
Copyright (C) 2015 Chris Aumann
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
Dependent cookbooks
apt >= 0.0.0 |
nfs >= 0.0.0 |
mysqld >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
5.1.0
- Add
addon_lvm
recipe, to install the official OpenNebula LVM Addon
5.0.0
- Add
node['opennebula_ng']['version']
attribute to allow installing a specific version - Update default OpenNebula version to
5.0
4.14.3
- Add posibility to configure interfaces without an ip address (for bridges).
For this to work, a safeguard was removed that prevented interface configuration to be written to
/etc/network/interfaces
when no address was set.
4.14.2
- Re-license under GPLv3
4.14.1
- Update default OpenNebula version to
4.14
4.12.1
- BREAKING CHANGE: Add support for ipv6. Network configuration adaption required!
# Change node['opennebula_ng']['interfaces']['br0']['type'] = 'inet static' node['opennebula_ng']['interfaces']['br0']['address'] = '192.168.1.100' # To: node['opennebula_ng']['interfaces']['br0']['inet']['type'] = 'static' node['opennebula_ng']['interfaces']['br0']['inet']['address'] = '192.168.1.100'
4.12.0
- Update default OpenNebula version to
4.12.0
4.10.1
- Allow multiple ARs (address-ranges) in virtual network configuration
4.10.0
- Use OpenNebula 4.10 repositories. To upgrade, run
apt-get dist-upgrade
after deploying the cookbook. Make sure you also run the database migrations usingonedb upgrade
.
4.8.5
- Support new address range (AR) syntax in
virtual_network
recipe - Use --sha1 when changing password for serveradmin
- Deploy
id_rsa.pub
alongsideid_rsa
- Do not automatically restart network configuration. This is problematic, as it cuts off virtual machines from their network bridges.
4.8.4
- Fail hard when not using a valid network configration, instead of deploying an empty /etc/network/interfaces
4.8.3
- Add
node['opennebula_ng']['active']
attribute, which defaults to false. On non-active opennebula hosts we won't add networks/storage/users and will disable oned, scheduler and sunstone services, as OpenNebula is not capable of running as an active-active environment due to caching issues.
Compatibility changes:
- Set node['opennebula_ng']['active'] = true
on your currently active (master) host
4.8.2
- Add one_auth recipe, to set shared passwords for "oneadmin" and "serveradmin" users, as well as deploy ssh keys
Compatibility changes:
- Renamed node['opennebula_ng']['one_auth']
attribtue to node['opennebula_ng']['one_auth']['oneadmin']['auth_file']
- Renamed node['opennebula_ng']['one_home']
attribute to node['opennebula_ng']['one_auth']['oneadmin']['home']
4.8.1
- Use mariadb galera by default
4.8.0
- Upgrade to OpenNebula 4.8 packages
0.1.0
- Initial release of opennebula_ng
Collaborator Number Metric
5.1.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
5.1.0 failed this metric
FC064: Ensure issues_url is set in metadata: opennebula_ng/metadata.rb:1
FC065: Ensure source_url is set in metadata: opennebula_ng/metadata.rb:1
FC066: Ensure chef_version is set in metadata: opennebula_ng/metadata.rb:1
FC069: Ensure standardized license defined in metadata: opennebula_ng/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
5.1.0 passed this metric
Testing File Metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
5.1.0 failed this metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
5.1.0 failed this metric
FC064: Ensure issues_url is set in metadata: opennebula_ng/metadata.rb:1
FC065: Ensure source_url is set in metadata: opennebula_ng/metadata.rb:1
FC066: Ensure chef_version is set in metadata: opennebula_ng/metadata.rb:1
FC069: Ensure standardized license defined in metadata: opennebula_ng/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
5.1.0 passed this metric
Testing File Metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
5.1.0 failed this metric
FC065: Ensure source_url is set in metadata: opennebula_ng/metadata.rb:1
FC066: Ensure chef_version is set in metadata: opennebula_ng/metadata.rb:1
FC069: Ensure standardized license defined in metadata: opennebula_ng/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
5.1.0 passed this metric
Testing File Metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
5.1.0 failed this metric
5.1.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number