cookbook 'ovh-api', '~> 2.4.0'
ovh-api (8) Versions 2.4.0 Follow0
Configure and control your servers on OVH by its API
cookbook 'ovh-api', '~> 2.4.0', :supermarket
knife supermarket install ovh-api
knife supermarket download ovh-api
OVH API
Description
Use OVH API to configure your servers, domains, etc.
hosted by OVH. It includes an Ohai plugin used to load
OVH information in automatic attributes.
At the moment, this cookbook can configures the firewall associated to an
IP, the "FTP" backup associated to a dedicated server and the ohai plugin
loads the hardware specifications.
Requirements
Cookbooks and gems
Declared in [metadata.rb](metadata.rb) and in [Gemfile](Gemfile).
Platforms
- Should work on every GNU/Linux and may even work on Windows
- Tested on RHEL Family 7 (centos 7.2)
Usage
Prerequisite
First, you should get an application key, an application secret and a
consumer key with the necessary rights from OVH. More information on
https://api.ovh.com/g934.first_step_with_api.
Then you have to create an encrypted data bag containing these keys. By default
this data bags is named secrets and its item containing the OVH keys is
ovh-keys. Its decrypted content should be like:
{ "id": "ovh-keys", "app_key": "my_app_key", "app_secret": "my_app_secret", "consumer_key": "my_consumer_key" }
Finally do not forget to place the secret keys on the servers.
To verify your setup, add recipe[ovh-api::init]
in your runlist. If it
converges, your authentification with OVH is correctly configured.
An example of setup is given in
[test/integration/default](test/integration/default) directory.
Firewall
Add recipe[ovh-api::firewall]
in your run-list to configure the OVH firewall
for this server. You can configure each IP associated to this server. The
default one can be named primary.
Then for each IP, you can enable or disable the firewall and manage the rules.
The configuration syntax is the same as OVH API, for which you can find the
documentation at https://api.ovh.com/console.
Finally, you can find an example in [.kitchen.yml](.kitchen.yml).
Backup
recipe[ovh-api::backup]
applies two recipes recipe[ovh-api::backup_api]
and
recipe[ovh-api::backup_mount]
the first one will activate (or not) any
protocols offered by OVH to access the backup space (FTP, NFS, CIFS).
The second recipe will take care to mount the CIFS or NFS locally.
Note: because it is very complicated to test the mount locally and we only use
CIFS in production, NFS is not recommended.
Ohai
Add recipe[ovh-api::ohai]
in your run-list to install and load the Ohai
plugin. It will fetch different information and put them in node['ovh']
.
Test
This cookbook is tested in kitchen with the help of
webmock to intercept the HTTP REST
calls.
It uses a test cookbook [webmock](test/cookbooks/webmock) by setting
recipe[webmock::stubs]
and recipe[webmock::verify]
in the runlist:
stubs recipe initializes webmock and create the necessarily stubs while
verify recipe dumps all calls so they can later be checked by serverspec.
For more information, see [.kitchen.yml](.kitchen.yml) and [test](test)
directory.
Attributes
Configuration is done by overriding default attributes. All configuration keys
have a default defined in [attributes/default.rb](attributes/default.rb).
Please read it to have a comprehensive view of what and how you can configure
this cookbook behavior.
Note: for fields needing an IP address, it is possible to set an interface
name, which will be resolved to its first non-local address.
Recipes
default
Include all other recipes except init and ohai.
init
Initialize the OVH client.
firewall
Configure the firewall according to node['ovh-api']['firewall']
.
backup
Include backup_api and backup_mount recipes.
backup_api
Activate the backup space with protocols defined in
node['ovh-api']['backup']['protos']
.
backup_mount
Mount the backup space if the protocols are CIFS or NFS.
ohai
Install and load the Ohai plugin, add OVH information about the server in
node['ovh']
.
Resources/Providers
None.
Changelog
Available in [CHANGELOG](CHANGELOG).
Contributing
Please read carefully [CONTRIBUTING.md](CONTRIBUTING.md) before making a merge
request.
License and Author
- Author:: Vincent Baret (vbaret@gmail.com)
- Author:: Samuel Bernard (samuel.bernard@gmail.com)
Copyright (c) 2015-2017 Sam4Mobile, 2017-2018 Make.org 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.
Dependent cookbooks
ohai >= 4.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Changelog
2.4.0
Main:
- feat: add support for vps
- fix: update hashdiff constant
- HashDiff constant was renamed Hashdiff. Ref: https://github.com/liufengyun/hashdiff/issues/65
- fix: use cookbook_name in run_state
- fix: deep_sort hardware infos
Tests:
- test: switch to chefplatform images
- test: make kitchen.yml config file visible
- As recommended by official documentation
- test: include .gitlab-ci.yml from test-cookbook
- fix: accept chef license
- fix: add rspec-core to Gemfile
Misc:
- chore: set generic maintainer & helpdesk email
- chore: add supermarket category in .category
- doc: use doc in git message instead of docs
- style(rubocop): add FrozenStringLiteralComment
- style(rubocop): avoid comma after the last param
- style(rubocop): add empty line after guard clause
2.3.0
Main:
- feat(backup): add recipe for ovh backup space
- you can active dedicated "FTP" backup space
- mount it if you use NFS or CIFS
Tests:
- use .gitlab-ci.yml template [20170731]
- add build_pull for kitchen (get latest image)
Misc:
- fix license in metadata, set correct chef_version
- style(rubocop): fix wrong HeredocDelimiterNaming
- use karma for git format in contributing
- chore: set 2018 in copyright notice
2.2.0
Main:
- Handover maintenance to Make.org
- Add documentation on firewall rules
- Add new cases of vrack ifaces (compatible with more servers)
- Add support for cloud, add server type in Ohai
Tests:
- Tests work with shared runners!
- Use latest template for .gitlab-ci.yml [20170405]
- Set always_update_cookbooks in provisioner
Misc:
- Fix misc foodcritic and rubocop offenses
2.1.0
Main:
- Fix idempotence in firewall rules containing port configurations
2.0.0
Main:
- Work with ohai cookbook >= 4.x
Tests:
- Work with webmock >= 2.x
- Strengthen gitlab-ci tests
- remove previous container correctly
- add silence option to curl calls
- destroy containers even if tests fail
- Deactivate kitchen-docker_cli preparation (use image directly)
1.2.0
Main:
- Create OVH firewall for the server if needed and wait for it (55s max)
Tests:
- Switch kitchen driver to docker_cli
- Remove all platforms but centos and use prepared docker image
- Define Continuous Integration configuration with gitlab-ci
Misc:
- Fix rubocop offenses
- Rename CHANGELOG -> CHANGELOG.md and fix markdown
- Fix Gemfile, need k-docker_cli instead of k-docker
1.1.0
Main:
- Fix service_name detection, check all ips, not just eth0
- Create an Ohai plugin to add OVH information in node['ovh']:
- service_name, service name as defined in the interface
- primary_ip, static ip attributed by OVH
- primary_iface, network interface on which the primary ip is defined
- vrack_iface, network interface reserved for vrack
- hardware, from /specifications/hardware Install it by adding recipe['ovh-api::ohai'] in your runlist
Minor:
- Standardize docker images among cookbooks
- Create an universal image for centos/debian/ubuntu
- Fix all rubocop offenses
1.0.0
- Initial version with firewall configuration (/ip/firewall)
- Should work almost everywhere but tested on Centos 7, Debian 8 and Ubundu 1404
Collaborator Number Metric
2.4.0 passed this metric
Contributing File Metric
2.4.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
2.4.0 passed this metric
No Binaries Metric
2.4.0 passed this metric
Testing File Metric
2.4.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
2.4.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
2.4.0 passed this metric
2.4.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
2.4.0 passed this metric
No Binaries Metric
2.4.0 passed this metric
Testing File Metric
2.4.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
2.4.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
2.4.0 passed this metric
2.4.0 passed this metric
Testing File Metric
2.4.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
2.4.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
2.4.0 failed this metric
2.4.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