# Before starting ## Connect You are going to connect to a server using `ssh`. Ask your teacher for the IP address of the machine: ``` ssh root@ip_address ``` ## Host and Demo You are currently connected to a server which have docker installed. We will call this server: `localhost`. You also have a docker container running in the background. We will call this container: `demo`. During these lessons, you will be ask to use ansible to configure both `localhost` and `demo` # Installation Install ansible on `localhost` ``` # Figure out the command to do that ``` # First use ## Check install Check if ansible is correctly installed (and the version you have): ``` ansible --version ``` ``` ansible 2.10.8 config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible executable location = /usr/bin/ansible python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] ``` ## Ad-hoc ping Use the builtin `ping` module to do your first ad-hoc command: ``` ansible localhost -m ping ``` This should answer with `pong`, like this: ``` localhost | SUCCESS => { "changed": false, "ping": "pong" } ``` Q: What happened behing the scene? ## Ad-hoc shell The `shell` module is a very nice ansible builtin module that can be use to execute commands on a host, e.g. with localhost: ``` ansible localhost -m shell -a "hostname" ``` Result: ``` localhost | CHANGED | rc=0 >> isen-x ``` Q: what command can you use to get the IP of your machine? ## Ad-hoc setup The `setup` module is a builtin module that collects data (also known as `facts`) on hosts. These data can then be used as variables in your future playbooks (we will see that later). ``` ansible localhost -m setup ``` ``` # long list of variables ``` Q: using this module, what other command can you use to retrieve the ip of your host?