Skip to content

a basic service template for operating cloud-native services

Notifications You must be signed in to change notification settings

O1ahmad/basic-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible logo

Basic-Service

Galaxy Role GitHub release (latest by date) License: MIT

Configure and operate a basic cloud-native service: running anything from cypto blockchain clients to the immense app store of open-source (Apache, CNCF and beyond) services.

Requirements

Systemd, Docker SDK for Python (for Python 2.6 support, use the deprecated docker-py library instead), installation of the docker engine or a Kubernetes cluster.

Role Variables

Common

var description default
setup_mode infrastructure provisioning setup mode (container, k8s, systemd) container
name name of service to deploy required
command Command and arguments to execute on startup required
user service user to setup root
config configuration files associated with the service to mount {}
config_env environment variables to set within the service runtime {}
ports listening port information for a service {}
dataDir directory to store service runtime/operational data /tmp
hostDataDir host directory to store node runtime/operational data (container setups) /var/tmp
work_dir operational directory to store runtime artifacts /var/tmp
cpus CPU resources each deployed service can use (either percentage for systemd or cores for containers) 100
memory available memory resources each deployed service can use 1G
restart_policy service restart policy unless-stopped
uninstall whether to remove installed service and artifacts false

Container

var description default
image service container image to deploy

Systemd

var description default
binary_url URL of the binary file to download
binary_file_name_override Override the binary file name after moving it to the destination directory
binary_strip_components Strip NUMBER leading components from file names on extraction 0
destination_directory directory where the binary file will be placed after downloading/extracting /usr/local/bin
systemd Systemd deployment custom unit, service and install properties {}

Kubernetes (k8s)

To authorize access to the target Kubernetes cluster, set the following environment variables:

export KUBECONFIG=<path-to-the-kubeconfig-file>
export KUBE_CONTEXT=<context-within-the-kubeconfig-to-use>
var description default
helm_chart_path path to Helm chart to use for the service deployment/release ../../helm
helm_namespace Kubernetes namespace to deploy to default
helm_values_path file to load Helm chart values (see here for available values) values.yml

Containerized Apps

Dependencies

collections:
- name: community.docker

Example Playbook

- hosts: servers
  roles:
  • Launch a container that sleeps for infinity:
  - role: 0x0I.basic_service
    vars:
      name: sleepy-service
      image: busybox:latest
      command: ["sleep", "infinity"]

License

MIT

Author Information

This Ansible role was created in 2023 by O1.IO.

🏆 always happy to help & donations are always welcome 💸

  • ETH (Ethereum): 0x652eD9d222eeA1Ad843efec01E60C29bF2CF6E4c

  • BTC (Bitcoin): 3E8gMxwEnfAAWbvjoPVqSz6DvPfwQ1q8Jn

  • ATOM (Cosmos): cosmos19vmcf5t68w6ug45mrwjyauh4ey99u9htrgqv09

About

a basic service template for operating cloud-native services

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages