Skip to content

REve-Workshop/xyz.revecloud.re.ansible.reve-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

49f0ba5 · May 25, 2020

History

63 Commits
Apr 20, 2020
May 25, 2020
May 25, 2020
May 25, 2020
May 13, 2020
May 17, 2020
May 13, 2020
May 17, 2020
Dec 6, 2019
Dec 3, 2019

Repository files navigation

REVE setup ansible playbooks

Purpose

These playbooks allows to setup a machine, following my standard.

They are designed so they can also be used individually:

  • to keep a machine up to date with configuration changes, use deploy-config.yml.
  • to keep a machine up to date with new version of applications not managed by package managers, host-setup.yml.
  • when new users must be create on a machine, user-setup.yml.

Usage

The repository

You should fork it, and not clone it, if you plan to modify the content of the roles/ directory or if you want to use the directories meant to store various data used by the playbooks.

This has the following caracteristics:

  • Stay updated with my modifications.
  • Submit patches to this repository.
  • Store your own modifcations in your repository

Grand setup

ansible-playbook -i <inventory> grand-setup.yml
  • <inventory>, an inventory file listing machines impacted by the playbook.

This playbook call all the other playbooks:

  • to setup hosts.
  • create one user and install its applications on each host.
  • deploy the application’s configuration in the user’s $HOME directory of each host.

Host setup

ansible-playbook -i <inventory> host-setup.yml
  • <inventory>, an inventory file listing machines impacted by the playbook.

This playbook is in charge of:

  • Installing the softwares
  • Updating the softwares

It use both the package manager or by compiling the sources from a git repositories. It is to be used to update applications not maintained by package managers

User setup

ansible-playbook -i <inventory> user-setup.yml
  • <inventory>, an inventory file listing machines impacted by the playbook.

It allows to create new users and ensure that a user has the minimum tree structure in its $HOME directory.

Configuration deployment

ansible-playbook -i <inventory> deploy-config.yml
  • <inventory>, an inventory file listing machines impacted by the playbook.

It ensures that the configuration for a set of applications are deployed in a user’s $HOME directory and are at their latest version.

Repository structure

The repository is structured following the Ansible best pratices with some personal additions.

It is composed of the following main structures:

  • group_vars/, should be used to define variables used by the playbooks for specific host groups.
  • host_vars/, should be used to define variables used for specific hosts.
  • inventories/, should be used to store inventory files
  • roles/, contains the bulk of the ansible commands used by the playbooks.
  • users/, should be used to store the configuration related to each user to be deployed.

The other directories are not used currently.

group_vars

If this directory is used, it must contain one YAML file for each group specified in inventory files. The files must have the same name has the group they belong to.

A YAML file specifies the list of users to be created and maintained up to date in addition to the set of applications for a host to be functional.

The host-group-template.yml file, is an example file and contains all the instructions to create such file.

host_vars

Like group_vars/, but in this directory each file is linked to one host. Hence, each YAML file must be name like the host that will use it.

The host-template.yml file, is an example file and contains all the instructions to create such file.

inventories

It is here that you could store the files defining the hosts to be managed by the playbook. Refer to the Ansible documentation to know how to format the content of an inventory file.

A few example files are present in this directory, anyway.

roles

If you simply want to use my setup, you shouldn’t have to modify the content of this directory.

This is where the magic happens. each directory defines the rules to treat an aspect of the host management.

The common/ directory contains all the rules that can be reused, like installing a particular software using a package manager.

The other directories treat a particular cases of software and configuration deployment.

users

It can be used to store the files containing the data defining users’ software set, the related configuration and more generally there definition in the host’s system.

The file user-template.yml contains all the documentation describing the structure of such file.

The file names must match the user’s names defined in host_vars/ and group_vars/ files.

Playbooks

Deciding which task to perform

With the file <user-config.yml>, it is possible to limit the tasks of the playbooks.

The playbooks perform the following steps:

  1. Update the local copy of the repository containing the configuration.
  2. Create the user and its basic directory structure, if a new user is requested
  3. For each application configured, execute its role

For each application’s configuration, an ansible role is defined. Each role perform the following tasks:

  1. Install the software related to the configuration, if requested
  2. If deployment of the configuration is requested:
    1. Clean the user directory of any existing configuration for the application
    2. Deploy the last version of the configuration available

Author

  • Roland Everaert

Copyright

Copyright (c) 2020 Roland Everaert

About

Set of ansible playbooks to manage hosts in my infrastructure

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages