mirror of
https://github.com/IntenseWebs/servercode.git
synced 2025-02-25 18:55:26 -06:00
Add Semaphore
This commit is contained in:
parent
2a31af5277
commit
aacd55a2b2
@ -13,6 +13,10 @@ apt install sudo
|
||||
vi /etc/sudoers
|
||||
# username ALL=(ALL) ALL
|
||||
|
||||
# vi /etc/sudoers.d/mynewuser
|
||||
# mynewuser ALL=(ALL) NOPASSWD: ALL
|
||||
chmod 440 /etc/sudoers.d/mynewuser
|
||||
|
||||
sudo apt install openssh-server
|
||||
systemctl enable sshd
|
||||
systemctl start sshd
|
||||
|
81
semaphore.txt
Normal file
81
semaphore.txt
Normal file
@ -0,0 +1,81 @@
|
||||
https://www.learnlinux.tv/complete-ansible-semaphore-tutorial-from-installation-to-automation/
|
||||
https://github.com/ansible-semaphore/semaphore/releases
|
||||
https://www.semui.co/
|
||||
|
||||
sudo adduser --system --group --home /home/mynewuser mynewuser
|
||||
|
||||
sudo apt install mariadb-server
|
||||
sudo mysql_secure_installation
|
||||
sudo mariadb
|
||||
|
||||
CREATE DATABASE semaphore_db;
|
||||
GRANT ALL PRIVILEGES ON semaphore_db.* TO semaphore_user@localhost IDENTIFIED BY 'randomly_generated_password_here';
|
||||
exit
|
||||
|
||||
wget https://github.com/ansible-semaphore/semaphore/releases/download/v<VERSION>/semaphore_<VERSION>_linux_amd64.deb
|
||||
sudo dpkg -i semaphore*.deb
|
||||
semaphore setup
|
||||
semaphore server --config config.json
|
||||
sudo mkdir /etc/semaphore
|
||||
sudo mv config.json /etc/semaphore/
|
||||
sudo chown -R semaphore:semaphore /etc/semaphore
|
||||
|
||||
Creating a Systemd service
|
||||
sudo nano /etc/systemd/system/semaphore.service
|
||||
|
||||
[Unit]
|
||||
Description=Ansible Semaphore
|
||||
Documentation=https://docs.ansible-semaphore.com/
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
ConditionPathExists=/usr/bin/semaphore
|
||||
ConditionPathExists=/etc/semaphore/config.json
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/semaphore server --config /etc/semaphore/config.json
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
User=semaphore
|
||||
Group=semaphore
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable semaphore.service
|
||||
sudo systemctl start semaphore.service
|
||||
|
||||
Playbook Repository
|
||||
In order for us to continue with this example, you’ll need a Git repository with the following local.yml file inside:
|
||||
|
||||
---
|
||||
- hosts: my_servers
|
||||
become: true
|
||||
tasks:
|
||||
- name: Print OS info
|
||||
ansible.builtin.package:
|
||||
name: apache2
|
||||
|
||||
Configure Semaphore
|
||||
The following code is used to create an environment within Semaphore:
|
||||
|
||||
create environment
|
||||
|
||||
{
|
||||
"var_environment": "production"
|
||||
}
|
||||
|
||||
In order to ensure Semaphore can run commands properly, we’ll need a line similar to the one below added to /etc/sudoers.d/semaphore on the target (the instance that our Semaphore server will be configuring). Be sure to replace semaphore in both the file name and inside the file to match the username of the user you intend to use with Semaphore.
|
||||
|
||||
semaphore ALL=(ALL) NOPASSWD: ALL
|
||||
|
||||
Other config files
|
||||
The following format was used for the inventory file (be sure to change the information to match yours):
|
||||
|
||||
[all:vars]
|
||||
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
||||
|
||||
[web_servers]
|
||||
172.234.197.30
|
Loading…
Reference in New Issue
Block a user