Global configuration#

Enoslib provides a mechanism to set global configuration options to change its behaviour.

Number of Ansible forks#

Note

This is only supported since Enoslib 9.0.0. Previous versions had a fixed number of forks set to 100.

This controls the forks parameter of Ansible, i.e. the level of parallelism when running actions on nodes. The default value is 5, the same default as Ansible. If you want to control a large number of nodes and you have enough CPU and memory on the control host, you can increase this value. See Performance tuning for more discussion on performance tuning.

 1# Make sure your run this example from a dedicated Grid'5000 control node.
 2# See https://discovery.gitlabpages.inria.fr/enoslib/tutorials/performance_tuning.html
 3
 4import logging
 5import os
 6from pathlib import Path
 7
 8import enoslib as en
 9
10en.init_logging(level=logging.INFO)
11en.check()
12
13# Set very high parallelism to be able to handle a large number of VMs
14en.set_config(ansible_forks=100)
15
16# Enable Ansible pipelining
17os.environ["ANSIBLE_PIPELINING"] = "True"
18
19job_name = Path(__file__).name
20
21conf = en.VMonG5kConf.from_settings(job_name=job_name, walltime="00:45:00").add_machine(
22    roles=["fog"],
23    cluster="dahu",
24    number=200,
25    vcore_type="thread",
26    flavour_desc={"core": 1, "mem": 2048},
27)
28
29provider = en.VMonG5k(conf)
30
31# Get actual resources
32roles, networks = provider.init()
33
34# Wait for VMs to finish booting
35en.wait_for(roles)
36
37# Run same command on all VMs
38results = en.run_command("uname -a", roles=roles)
39for result in results:
40    print(result.payload["stdout"])
41
42
43# Release all Grid'5000 resources
44provider.destroy()

Automatic SSH jump host#

Note

This feature has been added in Enoslib 8.1.0.

Enoslib tries to detect if it runs inside or outside of the Grid’5000 network. When running outside, it automatically uses a SSH jump host through access.grid5000.fr for convenience, because this is necessary to control Grid’5000 nodes.

It is possible to force-enable or force-disable this automatic detection. This is useful when using the Grid’5000 VPN, because Enoslib does not detect this case and will still use the SSH jump host, even though it is unnecessary.

When disabling g5k_auto_jump, beware of any local SSH configuration in your ~/.ssh/config that will now be applied. Previous versions of Enoslib used to recommend setting up ~/.ssh/config to setup the SSH jump host, but this is no longer the case. You should remove any configuration block targeting *.grid5000.fr that you may have added for previous versions of Enoslib.

Other parameters#

All parameters are documented at set_config()