Skip to content

CSimpiFoN/finnet-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

App Deploy Ansible Playbook

Code Structure

.
├── inventory
│   ├── group_vars
│   │   ├── dev.yml
│   │   └── staging.yml
│   ├── dev.yml
│   └── staging.yml
├── roles
│   └── deploy_app
│       ├── defaults
│       │   └── main.yml
│       ├── tasks
│       │   ├── deploy.yml
│       │   └── main.yml
│       ├── templates
│       │   └── compose.yaml.tmpl
│       └── vars
│           └── main.yml
├── deploy_app.yml
└── README.md

Requirements

  • Python 3.8 or higher on the Ansible host
  • ansible_core 2.15.6 or higher on the Ansible host
  • Docker Swarm nodes on the Ansible targets (To have multiple replicas)

Playbook Functions

  • Prepares the Swarm OS to run the services
  • Checks if the host has enough resources to run the services (Using service requirements settings and resource reservations)
  • Deploys the Docker Compose configuration file
  • Starts the service up
  • Checks the service availability

Usage

Run the playbook against all environments:

ansible-playbook -i inventory deploy_app.yml

Or limit the run to certain environment (dev/stg)

ansible-playbook -i inventory/{environment}.yml deploy_app.yml

Design Considerations

  • The service configuration settings are passed as environmental variables to the containers
  • The Docker Compose configuration file is generated from template using the configuration taken from the role
  • The template only manages currently used functions, is another section has to be added, the template should be amended

Production Considerations

  • Never configure sensitive data like username/password from plain text setting
    • Use Ansible Vault to encrypt the values (Still going to be stored plain text on the Swarm host and in the container's environment variables)
    • Best to use an external secret store, like HashiCorp Vault

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published