Are you tired of manually remoting into your servers and updating them? Well today I have a treat for you. We're going to set up Ansible but with a GUI. Because everyone loves GUI's.
We're going to use the docker approach here. As It's quick and easy and can be easily managed and updated.
You can follow the docs here to install docker.
---
version: '3'
services:
semaphore:
image: semaphoreui/semaphore:v2.10.22
container_name: semaphore
hostname: semaphore
ports:
- "3000:3000"
environment:
- SEMAPHORE_DB_DIALECT=bolt
- SEMAPHORE_ADMIN=admin
- SEMAPHORE_ADMIN_PASSWORD=changeme
- SEMAPHORE_ADMIN_NAME=Admin
- SEMAPHORE_ADMIN_EMAIL=admin@localhost
volumes:
- semaphore_data:/var/lib/semaphore
- semaphore_config:/etc/semaphore
- tmp_config:/tmp/semaphore
restart: unless-stopped
volumes:
semaphore_data:
semaphore_config:
tmp_config:
However you spin up docker containers. Whether it's with docker-compose
from the cli or using portainer to set up the stack itself once that is all done you should be able to access the application at IP:3000
.
At its core Ansible is agent-less, so it needs no agent, just needs a way to connect to the server. In this case we just need some Good ole SSH Keys to connect to the server. Since Semaphore uses its own SSH Server we need to don't need it on the system unless you want to do it that way.
This should be self-explanatory but because I like you ill go over this again.
cd .ssh
ssh-keygen -t ed25519 -C "Semaphore"
I'll explain the bits here.
ssh-keygen
: The Command to generate the key.-t ed25519
: The type of key to be generated in this case ed25519.-C "GitHub"
This is a comment to be added to be the key, It is optional but helps me with what the keys are besides the name.Once the key is created and named all you need to do is add it to semaphore.
That can be done by following these steps.
Key Store --> New Key --> SSH Key from dropdown.
Name the key and paste the private key in the Dialog Box.
After that make sure the public key is in the Authorized_keys
file on the target machine.
We can test this by using a playbook. But first we need to built on an inventory.
For us to be able to do that follow the steps below.
`Inventory --> NEW INVENTORY --> Select Ansible --> Select Static
[linux servers]
172.18.8.40
File should look something like that.
Once that is done we're close to be being able to test. We just need a playbook.
Before we get to adding the Task we need a repo to test it on.
Let's use this repo here
Ansible's own test playbooks.
To add it follow these steps.
HTTPS
so selected none you may need to create a non key in the key store which is easyAdding None Key if needed
Almost Done Here folks, now we add the Task.
ping.yml
After that is all done you should be good to test the playbook if all the keys were added correctly. The playbook should be finished with a Success and a green okay in the window.
Well that is all for today folks, We set up Ansible semaphore and tested a playbook to verify all is working good. If you have any questions or something is not clear feel free to open an Issue.