<commit_before>Installation
============

.. contents:: Topics


.. _what_will_be_installed:

Basics / What Will Be Installed
```````````````````````````````

Ansible by default manages machines over the SSH protocol.

Once Ansible is installed, it will not add a database, and there will be no daemons to start or keep running.  You only need to install it on one machine (which could easily be a laptop) and it can manage an entire fleet of remote machines from that central point.  When Ansible manages remote machines, it does not leave software installed or running on them, so there's no real question about how to upgrade Ansible when moving to a new version.

.. _what_version:

What Version To Pick?
`````````````````````

Because it runs so easily from source and does not require any installation of software on remote
machines, many users will actually track the development version.

Ansible's release cycles are usually about four months long. Due to this short release cycle,
minor bugs will generally be fixed in the next release versus maintaining backports on the stable branch.
Major bugs will still have maintenance releases when needed, though these are infrequent.

If you are wishing to run the latest released version of Ansible and you are running Red Hat Enterprise Linux (TM), CentOS, Fedora, Debian, or Ubuntu, we recommend using the OS package manager.

For other installation options, we recommend installing via "pip", which is the Python package manager, though other options are also available.

If you wish to track the development release to use and test the latest features, we will share
information about running from source.  It's not necessary to install the program to run from source.

.. _control_machine_requirements:

Control Machine Requirements
````````````````````````````

Currently Ansible can be run from any machine with Python 2 (versions 2.6 or 2.7) or Python 3 (versions 3.5 and higher) installed (Windows isn't supported for the control machine).

.. note::
  Ansible 2.2 introduces a tech preview of support for Python 3 (versions 3.5 and higher). For more information, see `Python 3 Support <http://docs.ansible.com/ansible/python_3_support.html>`_.

This includes Red Hat, Debian, CentOS, OS X, any of the BSDs, and so on.

.. note::

    Mac OS X by default is configured for a small number of file handles, so if you want to use 15 or more forks you'll need to raise the ulimit with ``sudo launchctl limit maxfiles unlimited``. This command can also fix any "Too many open files" error.


.. warning::

    Please note that some modules and plugins have additional requirements. For modules these need to be satisfied on the 'target' machine and should be listed in the module specific docs.

.. _managed_node_requirements:

Managed Node Requirements
`````````````````````````

On the managed nodes, you need a way to communicate, which is normally ssh. By
default this uses sftp. If that's not available, you can switch to scp in
:file:`ansible.cfg`.  You also need Python 2.6 or later.

.. note::

   Ansible's "raw" module (for executing commands in a quick and dirty
   way) and the script module don't even need that.  So technically, you can use
   Ansible to install python-simplejson using the raw module, which
   then allows you to use everything else.  (That's jumping ahead
   though.)

.. note::

   If you have SELinux enabled on remote nodes, you will also want to install
   libselinux-python on them before using any copy/file/template related functions in
   Ansible. You can of course still use the yum module in Ansible to install this package on
   remote systems that do not have it.

.. note::

   Ansible 2.2 introduces a tech preview of support for Python 3. For more information, see `Python 3 Support <http://docs.ansible.com/ansible/python_3_support.html>`_.

   By default, Ansible uses Python 2 in order to maintain compatibility with older distributions
   such as RHEL 6. However, some Linux distributions (Gentoo, Arch) may not have a
   Python 2.X interpreter installed by default.  On those systems, you should install one, and set
   the 'ansible_python_interpreter' variable in inventory (see :doc:`intro_inventory`) to point at your 2.X Python.  Distributions
   like Red Hat Enterprise Linux, CentOS, Fedora, and Ubuntu all have a 2.X interpreter installed
   by default and this does not apply to those distributions.  This is also true of nearly all
   Unix systems.


   If you need to bootstrap these remote systems by installing Python 2.X,
   using the 'raw' module will be able to do it remotely. For example,
   ``ansible myhost --sudo -m raw -a "yum install -y python2 python-simplejson"``
   would install Python 2.X and the simplejson module needed to run ansible and its modules.

.. _installing_the_control_machine:

Installing the Control Machine
``````````````````````````````
.. _from_yum:

Latest Release Via Yum
++++++++++++++++++++++

.. note:: We've changed how the Ansible community packages are distributed.
  For users of RHEL/CentOS/Scientific Linux version 7, the Ansible community RPM
  package will transition from the EPEL repository to the Extras channel.  There will be no
  change for version 6 of RHEL/CentOS/Scientific Linux since Extras is not a part of version 6.

RPMs for RHEL7 are available from `the Extras channel <https://access.redhat.com/solutions/912213>`_.

RPMs for RHEL6 are available from yum for `EPEL
<http://fedoraproject.org/wiki/EPEL>`_ 6 and currently supported
Fedora distributions.

Ansible will also have RPMs/YUM-repo available `here <https://releases.ansible.com/ansible/rpm>`_.

Ansible version 2.4 can manage earlier operating
systems that contain Python 2.6 or higher.

You can also build an RPM yourself.  From the root of a checkout or tarball, use the ``make rpm`` command to build an RPM you can distribute and install.

.. code-block:: bash<commit_msg>Add dnf and yum commands in "Installation" section (#33369)<commit_after>Installation
============

.. contents:: Topics


.. _what_will_be_installed:

Basics / What Will Be Installed
```````````````````````````````

Ansible by default manages machines over the SSH protocol.

Once Ansible is installed, it will not add a database, and there will be no daemons to start or keep running.  You only need to install it on one machine (which could easily be a laptop) and it can manage an entire fleet of remote machines from that central point.  When Ansible manages remote machines, it does not leave software installed or running on them, so there's no real question about how to upgrade Ansible when moving to a new version.

.. _what_version:

What Version To Pick?
`````````````````````

Because it runs so easily from source and does not require any installation of software on remote
machines, many users will actually track the development version.

Ansible's release cycles are usually about four months long. Due to this short release cycle,
minor bugs will generally be fixed in the next release versus maintaining backports on the stable branch.
Major bugs will still have maintenance releases when needed, though these are infrequent.

If you are wishing to run the latest released version of Ansible and you are running Red Hat Enterprise Linux (TM), CentOS, Fedora, Debian, or Ubuntu, we recommend using the OS package manager.

For other installation options, we recommend installing via "pip", which is the Python package manager, though other options are also available.

If you wish to track the development release to use and test the latest features, we will share
information about running from source.  It's not necessary to install the program to run from source.

.. _control_machine_requirements:

Control Machine Requirements
````````````````````````````

Currently Ansible can be run from any machine with Python 2 (versions 2.6 or 2.7) or Python 3 (versions 3.5 and higher) installed (Windows isn't supported for the control machine).

.. note::
  Ansible 2.2 introduces a tech preview of support for Python 3 (versions 3.5 and higher). For more information, see `Python 3 Support <http://docs.ansible.com/ansible/python_3_support.html>`_.

This includes Red Hat, Debian, CentOS, OS X, any of the BSDs, and so on.

.. note::

    Mac OS X by default is configured for a small number of file handles, so if you want to use 15 or more forks you'll need to raise the ulimit with ``sudo launchctl limit maxfiles unlimited``. This command can also fix any "Too many open files" error.


.. warning::

    Please note that some modules and plugins have additional requirements. For modules these need to be satisfied on the 'target' machine and should be listed in the module specific docs.

.. _managed_node_requirements:

Managed Node Requirements
`````````````````````````

On the managed nodes, you need a way to communicate, which is normally ssh. By
default this uses sftp. If that's not available, you can switch to scp in
:file:`ansible.cfg`.  You also need Python 2.6 or later.

.. note::

   Ansible's "raw" module (for executing commands in a quick and dirty
   way) and the script module don't even need that.  So technically, you can use
   Ansible to install python-simplejson using the raw module, which
   then allows you to use everything else.  (That's jumping ahead
   though.)

.. note::

   If you have SELinux enabled on remote nodes, you will also want to install
   libselinux-python on them before using any copy/file/template related functions in
   Ansible. You can of course still use the yum module in Ansible to install this package on
   remote systems that do not have it.

.. note::

   Ansible 2.2 introduces a tech preview of support for Python 3. For more information, see `Python 3 Support <http://docs.ansible.com/ansible/python_3_support.html>`_.

   By default, Ansible uses Python 2 in order to maintain compatibility with older distributions
   such as RHEL 6. However, some Linux distributions (Gentoo, Arch) may not have a
   Python 2.X interpreter installed by default.  On those systems, you should install one, and set
   the 'ansible_python_interpreter' variable in inventory (see :doc:`intro_inventory`) to point at your 2.X Python.  Distributions
   like Red Hat Enterprise Linux, CentOS, Fedora, and Ubuntu all have a 2.X interpreter installed
   by default and this does not apply to those distributions.  This is also true of nearly all
   Unix systems.


   If you need to bootstrap these remote systems by installing Python 2.X,
   using the 'raw' module will be able to do it remotely. For example,
   ``ansible myhost --sudo -m raw -a "yum install -y python2 python-simplejson"``
   would install Python 2.X and the simplejson module needed to run ansible and its modules.

.. _installing_the_control_machine:

Installing the Control Machine
``````````````````````````````
.. _from_yum:

Latest Release via DNF or Yum
+++++++++++++++++++++++++++++

On Fedora:

.. code-block:: bash

    $ sudo dnf install ansible

On RHEL and CentOS:

.. code-block:: bash

    $ sudo yum install ansible

.. note:: We've changed how the Ansible community packages are distributed.
  For users of RHEL/CentOS/Scientific Linux version 7, the Ansible community RPM
  package will transition from the EPEL repository to the Extras channel.  There will be no
  change for version 6 of RHEL/CentOS/Scientific Linux since Extras is not a part of version 6.

RPMs for RHEL7 are available from `the Extras channel <https://access.redhat.com/solutions/912213>`_.

RPMs for RHEL6 are available from yum for `EPEL
<http://fedoraproject.org/wiki/EPEL>`_ 6 and currently supported
Fedora distributions.

Ansible will also have RPMs/YUM-repo available `here <https://releases.ansible.com/ansible/rpm>`_.

Ansible version 2.4 can manage earlier operating
systems that contain Python 2.6 or higher.

You can also build an RPM yourself.  From the root of a checkout or tarball, use the ``make rpm`` command to build an RPM you can distribute and install.

.. code-block:: bash
{'fraction_non_alphanumeric': 0.0800730957720741, 'fraction_numerical': 0.008389401113049257, 'mean_word_length': 4.108188375053033, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1871668', 'n_tokens_mistral': 3439, 'n_tokens_neox': 3096, 'n_words': 1735}