The Red Hat Ecosystem Catalog is the official source for discovering and learning more about the Red Hat Ecosystem of both Red Hat and certified third-party products and services.
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
31Modules2Plugins
Collection of modules for phoenixNAP Bare Metal Cloud API
Ansible collection of modules for interacting with the Bare Metal Cloud API. This collection contains the server module which allows you to automate Bare Metal Cloud server provisioning and management.
Bare Metal Cloud • Ansible Galaxy • Developers Portal • Knowledge Base • Support
:arrow_forward: Video tutorial: How to Create a Bare Metal Cloud Account in Minutes
:arrow_forward: Video tutorial: How to Deploy a Bare Metal Server in a Minute
Follow these helpful tutorials to learn how to install Ansible on Ubuntu and Windows machines.
This Ansible collection contains the server module which requires the Python requests HTTP library to work properly. If you don't have it installed on your machine already, run this command to install it:
pip install requests
Now install the Ansible collection by running:
ansible-galaxy collection install phoenixnap.bmc
You can view the server module documentation with this command:
ansible-doc phoenixnap.bmc.server
You need to create a configuration file called config.yaml and save it in the user home directory. This file is used to authenticate access to your Bare Metal Cloud resources.
In your home directory, create a folder .pnap and a config.yaml file inside it.
This file needs to contain only two lines of code:
clientId: <enter your client id>
clientSecret: <enter your client secret>
To get the values for the clientId and clientSecret, follow these steps:
config.yaml file.Ansible Playbooks allow you to interact with your Bare Metal Cloud resources. You can create and delete servers as well as perform power actions with simple code instructions.
This example shows you how to deploy a Bare Metal Cloud server and delete it with Ansible Playbooks.
First, create a YAML file playbook_name.yml. The name part of the filename should contain the action you want to perform. To create a server, the filename can be playbook_create.yml.
Once you've created the file, open it and paste this code:
- name: Create new servers for account
hosts: localhost
gather_facts: false
vars_files:
- ~/.pnap/config.yaml
collections:
- phoenixnap.bmc
tasks:
- server:
client_id: "{{clientId}}"
client_secret: "{{clientSecret}}"
hostnames: [my-server-red]
location: PHX
os: ubuntu/bionic
type: s1.c1.medium
state: present
ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
To delete that same server, create a file called playbook_deprovision.yml and paste this code:
- name: reset servers
hosts: localhost
gather_facts: false
vars_files:
- ~/.pnap/config.yaml
collections:
- phoenixnap.bmc
tasks:
- server:
client_id: "{{clientId}}"
client_secret: "{{clientSecret}}"
hostnames: [my-server-red]
state: absent
Pay attention to the state item. This is where you tell Ansible which action you would like to perform. Here's a list of available options:
For more examples, check out this helpful tutorial: Bare Metal Cloud Playbook Examples
Become part of the Bare Metal Cloud community to get updates on new features, help us improve the platform, and engage with developers and other users.
Get in touch with us if you have questions or need help with Bare Metal Cloud.
| Product |
|---|
| 2.4 |