======================
Provisioning a cluster
======================

To provision or reprovision an existing cluster, run::

  $ adam provision -n [cluster-name]

EXAMPLE: To provision the cluster named "cluster":

.. code-block:: bash

   $ adam provision -n cluster


Customizing the provision command--advanced
===========================================

By default, the ``adam provision`` command:

* Checks SSH connectivity.
* Creates a default user.
* Installs Salt.
* Syncs formulas.
* Provisions enabled plugins and security
  settings that are defined in the cluster's profile.

To run only a portion of this provisioning process, use
``adam provision`` options and subcommands to control what
happens during provisioning.

Run ``adam provision --help`` to see the available options and
subcommands:

.. code-block:: bash

   $ adam provision --help
   Usage: adam provision [OPTIONS] COMMAND [ARGS]...

     Execute all the provisioning steps for a cluster

     See subcommands help for more info. Usage: adam provision -n

   Options:
     -n, --cluster TEXT    Cluster name  [required]
     --flush-iptables      Flush IPTables  [default: False]
     --selinux-permissive  Set SELinux to permissive  [default:
                             False]
     --selinux-context     Set SELinux contexts  [default: False]
     --plugins             Install enabled plugins on provision
                             [default: False]
     -h, --help            Show this message and exit.

   Commands:
     anaconda-user       Create the default anaconda user in all
                           the nodes
     check-ssh           Check SSH connection to the nodes
     flush-iptables      Flush IPTables
     plugins             Provision enabled plugins
     roles               Set roles on the cluster nodes
     salt                Provision Salt
     security-settings   Execute the security settings
     selinux-context     Set SELinux contexts
     selinux-permissive  Set SELinux to permissive
     sync                Sync formulas and settings

EXAMPLE: To check SSH connectivity to all of the nodes in an
existing cluster:

.. code-block:: bash

   $ adam provision -n cluster check-ssh
   Checking SSH connection to nodes
   2016-10-03 22:10:49,327 - adam.models - DEBUG - Checking ssh
   connection for 54.88.20.164
   2016-10-03 22:10:50,905 - adam.models - DEBUG - SSH
   connection to 54.88.20.164: OK
   2016-10-03 22:10:51,008 - adam.models - DEBUG - Checking ssh
   connection for 52.90.168.130
   2016-10-03 22:10:51,996 - adam.models - DEBUG - SSH
   connection to 52.90.168.130: OK
   +---------------+---------------+
   | Node IP       | SSH Available |
   +---------------+---------------+
   | 54.88.20.164  | True          |
   | 52.90.168.130 | True          |
   +---------------+---------------+
   | All nodes     | True          |
   +---------------+---------------+
