2.0 KiB
2.0 KiB
Server SetUp for Ansible
Create ssh key ed25519
ssh-keygen -t ed25519 -C "any-name"
Copy ssh key to server
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@hostIP
Create Server on Hetzner [details]
- Machine was created CX21 with SSH Private and Public Key Ed25519 by OnePassword
- Get private key from OnePassword and save it to ~/.ssh/id_ed25519
- Get public key from OnePassword and save it to ~/.ssh/id_ed25519.pub
- Add private key to ~/.ssh/config [Optional]
Disabling Password Authentication on our Server
- Open the SSH configuration file
sudo nano /etc/ssh/sshd_config
- Find the line that specifies PasswordAuthentication, uncomment it and set its value to no
PasswordAuthentication no
- Save and close the file
- Restart the SSH service
sudo systemctl restart ssh
Given Permission to use SSH Key
Change the permissions to 700: The keys need to be read-writable by the owner only:
chmod 700 ~/.ssh/[KEY_NAME]
Accesing the server with SSH Key Specifiing the ley Path Directly=
ssh -i ~/.ssh/[KEY_NAME] [USER]@[HOST]
Helpfull Links
Ansible
Ansible Steps
- Create Inventory
- Create Playbook
- Create Roles
- Create Tasks
- Create Handlers
- Create Templates
- Create Vars
Inventory
- Invetory is a file that contains a list of hosts that we want to manage with Ansible
Playbook
- Playbook is a file that contains a list of plays
- Play is a file that contains a list of tasks
- Task is a file that contains a list of modules
- Module is a file that contains a list of commands
Roles
- Roles is a folder that contains a list of tasks, handlers, templates, vars, defaults, files, meta, and tests