About:
This article contains Ansible code examples for implementing the Bright Computing Galaxy module.
https://galaxy.ansible.com/brightcomputing
Requirements:
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 ./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:
[headnodes] headnode01
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 tasks: - name: create login category brightcomputing.bcm92.category: name: login cloneFrom: default state: present roles_FirewallRole: - name: Firewall - name: Assigning software image to login category brightcomputing.bcm92.category: name: login softwareImageProxy: 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 tasks: - name: Clone physical node node001 to login001 brightcomputing.bcm92.physical_node: hostname: login001 cloneFrom: node001 provisioningInterface: BOOTIF state: present interfaces_NetworkPhysicalInterface: - name: BOOTIF network: internalnet ip: 10.160.0.100 startIf: ALWAYS cardtype: ethernet - name: eth1 ip: 0.0.0.0 network: externalnet dhcp: true