% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdftitle={ansible-instantaneous-server-communication},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{ansible-instantaneous-server-communication}
\author{}
\date{}

\begin{document}
\maketitle

\hypertarget{ansible-instantaneous-server-communication}{%
\section{ansible-instantaneous-server-communication}\label{ansible-instantaneous-server-communication}}

Ansible \#\#\#\#\#\#\#\# how to install on command and control server
============================================

First step install Ansible on your command and control server (laptop or
workstation, lol).\\
This section shows the process I used on Fedora.

install system dependancy

.. code-block:: bash

sudo yum -y install sshpass

clone the git repo and create python virtualenv

.. code-block:: bash

git clone git://github.com/ansible/ansible.git cd ansible virtualenv
.env

source the environment scripts

.. code-block:: bash

source ./hacking/env-setup source ./.env/bin/activate

install ansible and dependencies into python virtualenv

.. code-block:: bash

python setup.py develop

create an ansible hosts file in /etc/ansible/hosts

.. code-block:: bash

sudo mkdir /etc/ansible sudo vim /etc/ansible/hosts

put your targets into \emph{/etc/ansible/hosts} for example

.. code-block:: bash

127.0.0.1

and test!

.. code-block:: bash

ansible all -m ping --ask-pass

Ansible assumes SSH keys, but may also use passwords, which is invoked
with the \texttt{-\/-ask-pass} flag. Invoke the
\texttt{-\/-ask-sudo-pass} flag if you need to supply a sudo password.

\hypertarget{ansible-configuration-files}{%
\section{ansible configuration
files}\label{ansible-configuration-files}}

By default ansible looks to \emph{/etc/ansible} for its configurations.
In this section we document some of the configuration files ansible
works with.

/etc/ansible/hosts This file lists all ansible managed hosts and group
mappings.

/etc/ansible/host\_vars This directory may hold one YAML file for each
host. These files are used to pass host specific variables.

/etc/ansible/group\_vars This directory may hold one YAML file for each
group. These files are used to pass group specific variables.

/etc/ansible/group\_vars/all This is a special group that matches all
hosts and groups and holds variables for all hosts.

\hypertarget{behavioral-inventory-variables-and-parameters}{%
\section{Behavioral inventory variables and
parameters}\label{behavioral-inventory-variables-and-parameters}}

Sometimes you always want to set specific Ansible/SSH/settings for a
host, group of hosts, or all hosts.

For example, this \emph{all} file causes Ansible to use the root SSH
user:

.. code-block:: yml

\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}

ansible\_ssh\_user: root

Another example declares the parameters in the \emph{hosts} file itself.

\emph{/etc/ansible/hosts:}

.. code-block:: text

node1.example.com
ansible\_ssh\_private\_key\_file=/home/example/.ssh/aws.pem

Here is a list of other behavioral inventory parameters which may be set
in a host\_vars or group\_vars files:
http://docs.ansible.com/intro\_inventory.html\#list-of-behavioral-inventory-parameters

\hypertarget{how-to-prepare-remote-hosts}{%
\section{how to prepare remote
hosts}\label{how-to-prepare-remote-hosts}}

Ansible requires that remote hosts have an SSH service running, and that
your public \texttt{SSH\ key} is setup. Ansible also requires that all
remote hosts have Python 2.4.x and the python JSON library
(python-simplejson). Python 2.6.x and above ship with JSON library in
the stdlib, so nothing needs to be done if you are using a newer
operating system.

\hypertarget{quick-notes}{%
\section{quick notes}\label{quick-notes}}

run arbitary commands

.. code-block:: bash

ansible all --ask-pass -a ``uptime''

get all facts

.. code-block:: bash

ansible all --ask-pass -m setup

change the amount of parallel forks, (default is 5)

.. code-block:: bash

ansible all --ask-pass -f 20 -a ``uptime''

give path to a private key

.. code-block:: bash

ansible tutorial\_nodes --private-key=id\_rsa -m shell -a `free -m'

\end{document}
