Giter VIP home page Giter VIP logo

ansible-repertory's Introduction

Build Status

Overview

This repository is used as a good start point for infrastructure development. It contains basic roles and describes workflow to create solid solution.

The mastery of the ensemble is determined by the quantity and quality of plays performed. Repertory is created to comprise everything needed for server infrastructure of any level and complexity.

Basic principles

  • Playbook per application
  • All variables should be defined in environments' vars files

Directory structure

  • environments/ - root directory for environments
    • environment_dir/ - directory containing vars and hosts per environment
      • group_vars/ - variables defined per group
      • host_vars/ - variables defined per host
      • play_vars/ - variables defined per play in playbooks
      • inventory_file - inventory file with hosts related to the environment
  • molecule/ - molecule v2 configuration
    • resources/ - shared among molecule scenarios resources
    • scenario_name/ - specific molecule scenarios divided by platform, default - docker containers
  • playbooks/ - directory for playbooks, playbook per application
  • roles/ - custom roles
  • ansible.cfg - config for ansible
  • requirements.txt - python requirements
  • requirements.yml - ansible playbooks' requirements
  • site.yml - playbook containing every app in infrastructure

What goes where

Variables

Tasks

  • All tasks should be defined in roles

Playbooks

  • Playbooks contain only roles, groups of hosts and vars files
  • Playbook should contain everything needed for application to start
  • Avoid setting variables and tasks in playbooks
  • You can use site.yml as the only entrypoint for your configuration

Getting started

Fast start

  • Do not forget use Python 2.7 instead of 3.x. Molecule and Ansible doesn't support Python 3.x
  • Clone git repo
git clone [email protected]:express42/ansible-repertory.git
vagrant plugin install vagrant-parallels
  • Install prerequisites
cd ansible-repertory
ansible-galaxy install -r requirements.yml
pip install -r requirements.txt
touch vault.key
  • Run tests
molecule test

Using with your infrastructure

  • Remove excessive roles from requirements.yml, python modules from requirements.txt and playbooks
  • Make changes to site.yml
  • Make changes to vars files in example environment
  • Test changes with command
molecule test
  • Copy molecule environment to new environment
  • Make changes to inventory and vars files
  • Run command
ansible-playbook site.yml --inventory-file=./environments/new_environment/inventory

Molecule

molecule list
molecule converge
molecule status
molecule login common
molecule destroy

Testing using Travis-CI

  • Fork git repository
  • Add repository into Travis-CI
  • Push new commits

ToDo

  • Update default packages playbook
  • Add more playbooks or list recommended ones
  • Add base role (as it is in testo)

Known issues

  • 'zabbix_url' variable used in playbooks dj-wasabi.zabbix-agent and dj-wasabi.zabbix-server for different purposes
    • Workaround: redefine 'zabbix_url' in play_vars
  • API calls in playbook dj-wasabi.zabbix-agent made from several servers can interfere with each other
    • Workaround: make API calls serial
  • While using VirtualBox for testing you should change all mentions of interface 'eth0' to 'eth1'

Links

ansible-repertory's People

Contributors

dependabot[bot] avatar strangeman avatar vitkhab avatar

Watchers

 avatar

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.