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 does not mean the role will be reinstalled. Usually the recipe for a role skips the installation, which was successfully done. For example the installation of a conda environement. You maybe have to remove some things manually from the beamline inventory 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 skips 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 in a way, that, 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 or destroyed by executing the role a second time. This depends on the way the recipe was written.
If you need to execute the recipe again, you may have to remove files or directories or conda environment manually, depending on the role and the recipe you want to use.
For example the following command line reinstall the conda bliss environment after deleting the conda environment called bliss.
ssh blissadm@lid991 conda remove -n bliss --yes
./bcu_ansible.py lid991 bliss