elasticluster / elasticluster

Create clusters of VMs on the cloud and configure them with Ansible.
http://elasticluster.readthedocs.io/
GNU General Public License v3.0
335 stars 150 forks source link

Cluster Rollout to Baremetal #663

Open loewa opened 4 years ago

loewa commented 4 years ago

I would like to request a feature, where the elasticluster is simply using the given inventory for the rollout. This would be used in conjunction with a Ubuntu Maas bare metal provisioning. A switch to skip the cloud deployment would be sufficient. An adequate inventory file needs to be provided to rollout the various roles.

What do you think? Anyone like this idea, to extend to baremetal?

riccardomurri commented 4 years ago

Hello @loewa

thanks for your suggestion! It is actually already possible to use ElastiCluster's playbooks with a custom inventory, except it's not really advertised :-)

If you run elasticluster start (or setup) in full debug mode, you'll see a line like this in the logs:

    DEBUG Running Ansible command `ansible-playbook --private-key=.../.ssh/id_rsa .../elasticluster/elasticluster/share/playbooks/main.yml --inventory=.../.elasticluster/storage/spark.inventory --become --become-user=root -vv -e @extra_vars.yml` ...

To run on an existing cluster, you can simply:

  1. Replace the --inventory=.../.elasticluster/storage/cluster.inventory option with the path to an inventory file you provide: --inventory=/path/to/my/inventory.ini

  2. Provide an extra_vars.yml file containing the minimal amount of information that ElastiCluster playbooks need. It basically contains a YAML dump of the configuration; you can just have a look at any extra_vars.yml file created in a ElastiCluster working directory.

    Most keys are actually unused; a minimal extra_vars.yml file would look like this:

    elasticluster:
      cloud: {}
      nodes:
        # add one line per node
        master: {}
        worker001: {}
        # ...
      # replace with actual writable directory
      output_dir: /tmp

Might it be worth exposing this functionality through the command-line? If yes, how?

loewa commented 4 years ago

Riccardo, Many thanks for the information. I wil give it a try.

Kind regards, AL