First you need to make sure you have python installed. But I really can't think of any modern distros that
don't come with python installed. You can check this by typing....
python -V (make sure you use an upper case "V")
This should return something like
> Python 2.7.16
You can also use python3
python3 -V
> Python 3.7.3
If you accidentally typed a lower case "v" and you ended up in a python shell your prompt will change to something like this
>>>>
If that happens, just type quit() ...with the parenthesis.
To exit the python shell.
The next requirement is a C/C++ compiler. You don't really need to know how to do any C/C++ programming,
but this used to compile python modules that you will need to download.
For Fedora/Redhat/CentOS you can use...
sudo dnf group install -y "C Development Tools and Libraries" (for older versions use yum instead of dnf)
For Ubuntu you can use...
sudo apt install build-essential
The third requirement is something called pip. This is like apt-get or yum for python modules.
For Fedora/Redhat/CentOS you can use...
sudo dnf install python3-pip (if you don't have python3 installed just use python2-pip )
For Ubuntu you can use...
sudo apt-get -y install python3-pip
Now all of the requirements are done. Let's install ansible.
pip3 install ansible
This will take several seconds or so depending on your network speed and computer.
Now we will run your first ansible command.
ansible localhost -m setup
The will return several hundred lines of output about your computer. Maybe even some things you didn't know about your computer.
By default this outputs in JSON format. But there are ways to change that.
Next we will learn how to optimize ansible, and use playbooks.
don't come with python installed. You can check this by typing....
python -V (make sure you use an upper case "V")
This should return something like
> Python 2.7.16
You can also use python3
python3 -V
> Python 3.7.3
If you accidentally typed a lower case "v" and you ended up in a python shell your prompt will change to something like this
>>>>
If that happens, just type quit() ...with the parenthesis.
To exit the python shell.
The next requirement is a C/C++ compiler. You don't really need to know how to do any C/C++ programming,
but this used to compile python modules that you will need to download.
For Fedora/Redhat/CentOS you can use...
sudo dnf group install -y "C Development Tools and Libraries" (for older versions use yum instead of dnf)
For Ubuntu you can use...
sudo apt install build-essential
The third requirement is something called pip. This is like apt-get or yum for python modules.
For Fedora/Redhat/CentOS you can use...
sudo dnf install python3-pip (if you don't have python3 installed just use python2-pip )
For Ubuntu you can use...
sudo apt-get -y install python3-pip
Now all of the requirements are done. Let's install ansible.
pip3 install ansible
This will take several seconds or so depending on your network speed and computer.
Now we will run your first ansible command.
ansible localhost -m setup
The will return several hundred lines of output about your computer. Maybe even some things you didn't know about your computer.
By default this outputs in JSON format. But there are ways to change that.
Next we will learn how to optimize ansible, and use playbooks.
Last edited: