Hybrid Cloud with IBM Z - Group home

Using the Ansible playbook to operate IBM Cloud Infrastructure Center

By Gerald Hosch posted Mon June 14, 2021 07:09 AM

  

Abstract

This blog provides a sample how to use Red Hat® Ansible® playbook with IBM® Cloud Infrastructure Center. Ansible is widely used in the IT world to achieve automation, and Cloud Infrastructure Center, providing OpenStack compatible APIs, can be used with OpenStack Ansible playbook.
Note, the reader of this blog should understanding the basics of Ansible and OpenStack.
Written by Chen Ji.

Steps

Step 1: For Ansible playbook, the installation from the upstream open source openstack.cloud ansible collection is recommended; for more information refer to: https://github.com/openstack/ansible-collections-openstack


Step 2: You need a Linux machine to run Ansible playbooks.

Step 3: Run the command: 'pip install ansible openstacksdk' to install Ansible and openstacksdk. You will see 'Successfully installed' in the output, or you need check your system settings.




Step 4: Run the command: 'ansible-galaxy collection install openstack.cloud' to install openstack.cloud ansible collection. You should see 'openstack.cloud <version> was installed successfully', or you need check your system settings.


Step 5: Define a 'clouds.yaml', for the detailed definition of the file refer to https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html#config-files

You need to modify the value according to your cloud settings:

Explanations on key configuration items:  

 auth_url 

The auth url that OpenStack keystone service is running on  

 project_id 

The ID of the project that you are operating against. 

 cacert 

The cert file that you needed to communicate with Cloud Infrastructure Center, you can find the file at ‘/etc/pki/tls/certs/icic.crt’ at Cloud Infrastructure Center management node by default. 


Step 6: Define a run.yaml (the name is just an example)

In this step a virtual machine is created, for the detailed description on each item or other functionalities, refer to https://github.com/openstack/ansible-collections-openstack



Explanations on key configuration items:  

 name 

The name of the virtual machine to be deployed 

 image 

Create a virtual machine with given image ID 

 timeout 

Wait seconds before the action timeout, in Cloud Infrastructure Center, we recommend set this value to bigger than 1800 especially when IBM z/VM® is used. 


Step 7: All preparations are done. We can start to execute the Ansible ‘ansible-playbook run.yaml’, and finally the virtual machine will be created successfully.



Conclusion:

IBM Cloud Infrastructure Center, providing OpenStack compatible APIs, can be used by OpenStack Ansible playbook to automate infrastructure management.

0 comments
11 views