Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ismet55555/ansible-configure

Ansible playbooks to automatically configure for various systems
https://github.com/ismet55555/ansible-configure

ansible ansible-playbook automation configuration configuration-management raspberry-pi ssh

Last synced: about 2 months ago
JSON representation

Ansible playbooks to automatically configure for various systems

Awesome Lists containing this project

README

        

# Ansible Configure
Ansible playbooks and utility scripts to setup different systems.

# Running an Ansible Playbook
You will find the ansible playbooks in `.yml` files. The following command will run an ansible playbook. This executed using the terminal.

`ansible-playbook .yml`

Examples:
- `ansible-playbook Raspberry_Pi_OS/rpi-all.yml`
- `ansible-playbook Raspberry_Pi_OS/rpi-all.yml --tags basics`
- `ansible-playbook Raspberry_Pi_OS/docker.yml --limit cluster-pi-group`
- `ansible-playbook Raspberry_Pi_OS/rpi-config.yml --limit cluster-pi-1`

Some Useful Options:
- `-K` - Ask for privellage escalation (aka sudo)
- `--tags` - Only target the playbook tasks with specific tags
- `--limit` - Only target specified hosts or host groups

For more `ansible-playbook` options, checkout the amazing documentation:
https://docs.ansible.com/ansible/2.7/cli/ansible-playbook.html

------

# Generate Key Pair and Distribute to Remote Devices

To not have to enter a password every time you SSH into a device, you can create a key pair and send the public key to the remote device you are SSH-ing into.

In fact, you probably need to do this for ansible to smoothly operate.

## Create a Private-Public Key-Pair (if needed)
1. Install OpenSSH locally (if needed)
- `sudo apt-get install openssh-server`
2. Generate the SSH private-public key-pair
- `ssh-keygen`
- Enter some name for the key-pair
- Don't need the password unless you are really worried about the security of this system
- The key-pair will be saved locally in the `~/.ssh` directory

## Distribute the Public Key the Cool Kids Automatic and Scalable Way
This way is much better if you are working with many remote hosts/devices.

1. Go to the `Utilities/Distribute_SSH_Keys` directory
2. In `remote_host_list.txt`, add the remote host/device IP addresses to the list
3. Specify the following in `distribute_ssh_key.sh`
```bash
SSH_PUBLIC_KEY_LOCATION="/home//.ssh/public-key.pub"
REMOTE_HOST_USERNAME=" `
- Example:
- `ssh-copy-id -i /home/my-username/.ssh/my-cool-key.pub 192.168.0.50`
2. Check the SSH Connection (Should not have to enter password)
- `ssh -i @`
- Example:
- `ssh -i /home/my-username/.ssh/my-cool-key [email protected]`

**SEMI-PRO TIP:** If you are using the keyname `id_rsa` you will not need the `-i` flag with the path to the key

# Licence
This project is licensed under the Apache 2.0 License - Please see the [LICENSE](LICENSE) file for details.