1. Home
  2. Bright Computing Ansible galaxy module examples

Bright Computing Ansible galaxy module examples


This article contains Ansible code examples for implementing the Bright Computing Galaxy module.


These instructions have been tested on Bright 9.2 (9.2-13) and later releases.
Functional Ansible environment (Python 3.9, Ansible 2.10+)

Setup the Ansible environment:

There are a number of approaches to installing Ansible. This approach uses a virtual environment (Miniconda).
These commands may be run as root, it is however safer to run them as a non-root user. In the example below, Miniconda is installed to /cm/shared/anaconda.

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod u+x Miniconda3-latest-Linux-x86_64.sh
source /cm/shared/anaconda/bin/activate
conda create -n py3.9 python=3.9
conda activate py3.9
git clone https://github.com/Bright-Computing/bright-installer-ansible.git
cd bright-installer-ansible/playbooks/non-cloud
pip install -r requirements-control-node.txt
ansible-galaxy collection install brightcomputing.bcm92

Ansible Code Examples:

Create an Ansible hosts file.

The ansible hosts file contains the hostname of the headnode. This is where the Ansible playbooks are executed to update the objects within cmdaemon.
For example:


Example Ansible command

ansible-playbook -i hosts myplaybook.yaml

Create a category, assign a role to that category, assigned software image to the category.

The below example clones the default category to a new category called “login”. 
Assigns the firewall roles to the login category.
Configures the login category software image to “login-image”

- hosts: all
  gather_facts: false
- name: create login category
    name: login
    cloneFrom: default
    state: present
    - name: Firewall
- name: Assigning software image to login category
    name: login
      parentSoftwareImage: login-image

Create a physical node, and configure the interfaces.

This example clones node001 to a node called “login001” and configures the networking interfaces.

- hosts: all
  gather_facts: false
    - name: Clone physical node node001 to login001
        hostname: login001
        cloneFrom: node001
        provisioningInterface: BOOTIF
        state: present
          - name: BOOTIF
            network: internalnet
            startIf: ALWAYS
            cardtype: ethernet
          - name: eth1
            network: externalnet
            dhcp: true


Updated on August 30, 2023

Leave a Comment