Giter Club home page Giter Club logo

semaphore-rest-automation's Introduction

Semaphore-Rest-Automation

An easy-to-use Ansible playbook to set up a Semaphore Tenant through its own REST APIs.


The Ansible playbook is going to reference a Semaphore REST API server by creating/updating a set of semaphore objects through REST APIs. The ansible application logic is placed on a Git Repo from which you should provide Oauth2 personal access token to login on.


Aim

Ansible is an open source automation and orchestration tool for software provisioning, configuration management, and software deployment.

Nevertheless, it's a good practice to integrate playbooks with UI systems and provide a smart workflow to even users who prefers better to interact with a UI based interface to invoke their own jobs.

Ansible Semaphore is a responsive web UI for running Ansible playbooks. It's written in pure Go and available for Windows, macOS and Linux (x64, ARM, ARM64). Furthermore, it provides a set of REST interfaces to make easier the way you can interact with the backend system in order to automate workflows.

Therefore, the aim of this project is to provide a starter playbook to automate your own Semaphore Tenant with its own REST APIs. All this stuff is based on Ansible as well.

Dependencies


  1. Ansible - Configuration Management
  2. Ansible Semaphore -Ansible Modern UI - to set up follow this guide
  3. OAuth Git Repo - be sure to create an access token allowed to clone the repo where you store your own playbooks to be running towards your infrastructure target.
  4. Semaphore User - allowed to perform REST calls towards the REST API Server

Configuration


  1. Clone the Repo

$ git clone https://github.com/amedeopalopoli/semaphore-rest-automation.git

  1. Locate the configuration file

$ cat vars/main.yml

Point out your Semaphore REST API Server as reported below in yourautomationurl

# OVERALL VARIABLES

#Base URL Semaphore REST API Server -> <FQDN>/api
automation: "https://yourautomationurl/api"

Here, you are the security credentials to login through OAuth protocol to your own Semaphore REST API

#Basic Auth to Login to REST API Semaphore Server
user: "username"
password: "password"

After you earned the personal access token from your Git repo place that one here

#Personal Access Token to clone the code from your Ansible Repo
pat: "your_personal_access_token" 
git_repo: "gitlab.com/your_repo.git"

In order to use an OAuth2 git login the security key store with Semaphore is enough to use the None Security Keys Store Type

#Semaphore Key Type to clone the code through OAUTH2 Personal Access Token
semaphore_key_store_name: "None"
semaphore_key_store_type: "none"

Here, you are the application specific properties to customize your needs with the environments you have. Notice, how you can select even the cron format to run automatically your jobs for scheduling batch activities like backup and so on.

## PROJECT SPECIFIC VARIABLES
project_id: "semaphore_example"

envs:
  - name: develop
    cron: "0 0 * * *"
  - name: staging
    cron: "0 0 * * *"
  - name: production
    cron: "0 0 * * *"

How to use


$ ansible-playbook playbook-semaphore-project.yml

Contributing


  1. Fork the repository
  2. Create a new branch
  3. Contribute!
  4. Open a pull request

Obviously is ok if you want to improve the content and similar things. Whatever you think would be changed, feel free to open and issue and lets discuss it before.

semaphore-rest-automation's People

Contributors

amedeopalopoli avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

ricricucit j00x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.