class elasticluster.providers.ansible_provider.AnsibleSetupProvider(groups, playbook_path=None, environment_vars={}, storage_path=None, sudo=True, sudo_user='root', ansible_module_dir=None, **extra_conf)[source]

This implementation uses ansible to configure and manage the cluster setup. See https://github.com/ansible/ansible for details.

  • groups (dict) – dictionary of node kinds with corresponding ansible groups to install on the node kind. e.g [node_kind] = [‘ansible_group1’, ‘ansible_group2’] The group defined here can be references in each node. Therefore groups can make it easier to define multiple groups for one node.
  • playbook_path (str) – path to playbook; if empty this will use the shared playbook of elasticluster
  • environment_vars (dict) – dictonary to define variables per node kind, e.g. [node_kind][var] = value
  • storage_path (str) – path to store the inventory file. By default the inventory file is saved temporarily in a temporary directory and deleted when the cluster in stopped.
  • sudo (bool) – indication whether use sudo to gain root permission
  • sudo_user (str) – user with root permission
  • ansible_module_dir (str) – path to addition ansible modules
  • extra_conf – tbd.
  • groups – node kind and ansible group mapping dictionary
  • environment – additional environment variables

Deletes the inventory file used last recently used.

Parameters:cluster (elasticluster.cluster.Cluster) – cluster to clear up inventory file for

Configures the cluster according to the node_kind to ansible group matching. This method is idempotent and therefore can be called multiple times without corrupting the cluster configuration.

Parameters:cluster (elasticluster.cluster.Cluster) – cluster to configure
Returns:True on success, False otherwise. Please note, if nothing has to be configures True is returned
Raises:AnsibleError if the playbook can not be found or playbook is corrupt