< Home

Ansible, Redfish and Sushy

1 16 2019

In last December(2018), I started my Outreachy [1] internship at OpenStack working on "Create Redfish Ansible module" project. So, this is me trying to explain my project to someone completely new to this. Here goes,

Ansible...

IT automation includes processes and software that help in deploying and managing an IT infrastructure(servers, networking, storage, etc.). In short, Ansible [2] is a simple, agent-less and powerful open source IT automation tool. It uses a very simple language YAML [3] (YAML Ain't Markup Language) in form of playbooks that allow you to describe your automation tasks in a way that approaches plain English. Also, Ansible doesn’t require any agent on client machines unlike other automation tools(Puppet, Chef, Salt). It uses just a SSH connection to connect the servers. Ansible requires Python to be installed on the client machines.

Bellow a simple Ansible playbook(install_apache.yaml) to install Apache HTTP Server on a Debian based remote server.

- hosts: all
  remote_user: root
  tasks:
    - name: Install Apache
      apt:
        name: apache2
        state: latest

To execute the playbook on a single server, you can use this command: ansible-playbook -i 100.58.17.57, install_apache.yaml. If you have 100 or more remote servers and you want to install apache2 on each of them, with Ansible you can automate this repetitive task using that same command. First, put remote IP addresses on a file(HOSTS) and then execute ansible-playbook -i HOSTS install_apache.yaml

Redfish...

If you’re very much new to Cloud infrastructure related topics, just like me, you have probably never heard of the BMC [4] (baseboard management controller). BMC is a small computer that sits on every server motherboard and it's used to perform remote management tasks that a sysadmin would otherwise need to physically do on the racked server(power-on, reset, etc.). In shot, Redfish [5] is one of the newest protocols used to interact with the BMC. Redfish leverages common internet and web services standard to expose information directly to the modern tool chain. Redfish specifies a RESTFul [6] interface and utilizes defined JSON payloads, usable by client applications and browser based GUI. Following Python code sample shows how to retrieve the serial number from a remote server using Redfish.

import json
from urllib.request import urlopen

data = urlopen('http://100.58.17.57/redfish/v1/Systems/1')
json_data = json.loads(data)
print(json_data['SerialNumber'])

Sushy and Sushy-tools...

Sushy [7] is a client side Python implementation of the Redfish protocol and and it can be used to communicate with Redfish based systems.

Sushy-tools [8] contains two emulators sushy-static and sushy-emulator, aiming at supporting the development and testing of the Redfish protocol implementations, in particular Sushy library. To simply put, Sushy-tools are the Redfish emulators(just like an Android emulator).

The Project...

From the previous install_apache.yaml example(at line 5) I'm using the apt Ansible module. Ansible modules are just piece of code that can be written in any language(but mostly written in Python) with the condition that its output needs to be in the JSON format. My project is to create a new custom Redfish, Ansible module to automate the power and boot process of a remote server and to make sure those features work correctly on both module side and in the sushy-emulator. Also, update existing Redfish, Ansible modules [9], [10] to work properly in the sushy-emulator.

[1] https://dnuka.github.io/openstack-internship.html

[2] https://github.com/ansible/ansible

[3] https://yaml.org/

[4] https://en.wikipedia.org/wiki/Intelligent_Platform_Management_Interface#Baseboard_management_controller

[5] https://www.dmtf.org/standards/redfish

[6] https://www.codecademy.com/articles/what-is-rest

[7] https://github.com/openstack/sushy

[8] https://github.com/openstack/sushy-tools

[9] https://github.com/ansible/ansible/tree/devel/lib/ansible/modules/remote_management/redfish

[10] https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/redfish_utils.py