---
type: archive
area: archive
status: archived
date: 2026-05-03
created: 2026-05-03
updated: 1980-01-01
tags:
  - archive
---
Copying SSH key to destination machine with **ssh-copy-id** it's not enough to connect to the wanted machine but we need to load the key into the memory with **ssh-agent** using those commands.

```
eval $(sss-agent)
```

```
ssh-add <path to the key>
```
Now the key should be loaded to the memory and automatically injected in the connection.

## Ansible commands:

- Get information from hosts 
```
ansible all -m gather_facts
```
 - Limit output to a specific host
```
ansible all -m gather_facts --limit <host_ip>
```
- Update repositories cache (it will fails if  we don't add root permission)
```
ansible all -m apt -a update_cache=true
```
- It will ask for sudo password
```
ansible all -m apt -a update_cache=true --become --ask-become-pass
```
- This for installing a specific package
```
ansible all -m apt -a name=<package_name> --become --ask-become-pass
```
- This will update or install packages if there is an update
```
ansible all -m apt -a "name=<package_name> state=latest" --become --ask-become-pass
```
- This will update all packages to last version
```
ansible all -m apt -a "upgrade=dist" --become --ask-become-pass
```
