Skip to content

Updating a beamline computer with Ansible

A python script is provided to only update a specific role (or a set of roles).

This can be use for different use cases.

  • Speed up the installation of a role (to skip mostly everything else)
  • Make sure no other changes will be done in this machine

Quickstart

Purpose

Updating a role only can work if the machine was already installed once normally with ansible.

./bcu_ansible.py machine role [role2]

Purpose

Without any roles the script will behave like the normal shell script: a full normal installation.

Purpose

This do not mean the role will be reinstalled. Usually the recipe for a role skip installation which was successfully done. For example the installation of a conda environement. You maybe have to remove some stuffs manually in the beamline anyway.

Principles

The script from the BCU is a wrapper on top of the default ansible command line.

An Ansible recipe is a kind of tree of tasks to execute, including top level roles defined by the BCU (for example bliss or mainstation).

This roles are defined in the directory ./roles and linked from the main entry file bcu_env.yml.

To only execute a specific role, the script uses the argument Ansible argument --skip-tags, and skip most of the roles defined by the BCU, except the one specified by the user in the command line.

Usage

For example, the update of the role bliss of the lid991 target computer can be done with:

./bcu_ansible.py lid991 bliss

This command will skip tags like install_tango_db, install_tomovis… but not the one containing install_bliss, and the recipe to install BLISS will be executed.

Usually a recipe for a role is written such a way if it is re-executed it will not be reinstalled. Imagine that you have installed a conda environment with a role and changed it’s content manually. This environment will not be changed again by executing the role. This depends on the way the recipe was written.

In this case you will have to remove some directories or files manually. Depending on the role and the recipe you want to use.

For example the following command line will force to reinstall the conda bliss environment.

ssh blissadm@lid991 conda remove -n bliss --yes
./bcu_ansible.py lid991 bliss