Ansible beginner

Install

 1sudo apt install ansible
 2#or use pip3
 3pip3 install --user ansible
 4ansible --version
 5# ansible [core 2.12.4]
 6#   config file = None
 7#   configured module search path = ['/home/rogers/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
 8#   ansible python module location = /usr/lib/python3/dist-packages/ansible
 9#   ansible collection location = /home/rogers/.ansible/collections:/usr/share/ansible/collections
10#   executable location = /bin/ansible
11#   python version = 3.10.4 (main, Mar 24 2022, 13:07:27) [GCC 11.2.0]
12#   jinja version = 3.0.3
13#   libyaml = True
14ssh-copy-id [email protected]
15#input your password

define your inventory file

hosts file

1[localhost]
2127.0.0.1
 1ansible -i hosts -m ping
 2# 127.0.0.1 | SUCCESS => {
 3#     "ansible_facts": {
 4#         "discovered_interpreter_python": "/usr/bin/python3.10"
 5#     },
 6#     "changed": false,
 7#     "ping": "pong"
 8# }
 9ansible-doc ping
10#show module help