All Projects → leucos → Ansible Tuto

leucos / Ansible Tuto

Licence: other
Ansible tutorial

Programming Languages

shell
77523 projects
HTML
75241 projects

Projects that are alternatives of or similar to Ansible Tuto

Ansible Interactive Tutorial
Interactive Ansible tutorials with dead simple setup via Docker
Stars: ✭ 1,309 (-33.18%)
Mutual labels:  ansible, tutorial
Packer Ubuntu 1804
This build has been moved - see README.md
Stars: ✭ 101 (-94.84%)
Mutual labels:  ansible, vagrant
Beetbox
Pre-provisioned L*MP stack
Stars: ✭ 94 (-95.2%)
Mutual labels:  ansible, vagrant
Jjg Ansible Windows
[DEPRECATED] Windows shell provisioning script to bootstrap Ansible from within a Vagrant VM.
Stars: ✭ 82 (-95.81%)
Mutual labels:  ansible, vagrant
Infrastructure As Code Tutorial
Infrastructure As Code Tutorial. Covers Packer, Terraform, Ansible, Vagrant, Docker, Docker Compose, Kubernetes
Stars: ✭ 1,954 (-0.26%)
Mutual labels:  ansible, vagrant
Devbox Golang
A Vagrant box with Ansible provisioning for setting up a vim-based Go(lang) development environment
Stars: ✭ 84 (-95.71%)
Mutual labels:  ansible, vagrant
Vagrant Box Templates
Stars: ✭ 100 (-94.9%)
Mutual labels:  ansible, vagrant
Splunkenizer
Ansible framework providing a fast and simple way to spin up complex Splunk environments.
Stars: ✭ 73 (-96.27%)
Mutual labels:  ansible, vagrant
Vagrant Elastic Stack
Giving the Elastic Stack a try in Vagrant
Stars: ✭ 131 (-93.31%)
Mutual labels:  ansible, vagrant
Packer Windoze
Packer templates to create Windows vagrant box images
Stars: ✭ 117 (-94.03%)
Mutual labels:  ansible, vagrant
Kubernetes The Ansible Way
Bootstrap Kubernetes the Ansible way on Everything (here: Vagrant). Inspired by Kelsey Hightower´s kubernetes-the-hard-way, but refactored to Infrastructure-as-Code.
Stars: ✭ 82 (-95.81%)
Mutual labels:  ansible, vagrant
Gitlab Ci Stack
Full CI pipeline project based on Gitlab & Gitlab CI running Docker, completely automated setup by Vagrant & Ansible, providing Let´s Encrypt certificates for private Servers, multiple Gitlab-Runners and the Gitlab Container Registry, incl. GitLab Pages
Stars: ✭ 146 (-92.55%)
Mutual labels:  ansible, vagrant
Packer Ubuntu 1404
DEPRECATED - Packer Example - Ubuntu 14.04 Vagrant Box using Ansible provisioner
Stars: ✭ 81 (-95.87%)
Mutual labels:  ansible, vagrant
Learning Tools
A collection of tools and files for learning new technologies
Stars: ✭ 1,287 (-34.3%)
Mutual labels:  ansible, vagrant
Packer Centos 6
This build has been moved - see README.md
Stars: ✭ 78 (-96.02%)
Mutual labels:  ansible, vagrant
Drupal Vm
A VM for Drupal development
Stars: ✭ 1,348 (-31.19%)
Mutual labels:  ansible, vagrant
Showcase Ansible Chatops
Vagrant Demo showing ChatOps with Ansible
Stars: ✭ 71 (-96.38%)
Mutual labels:  ansible, vagrant
Molecule Ansible Docker Aws
Example project showing how to test Ansible roles with Molecule using Testinfra and a multiscenario approach with Docker, Vagrant & AWS EC2 as infrastructure providers
Stars: ✭ 72 (-96.32%)
Mutual labels:  ansible, vagrant
Rhcsa8env
This is a RHCSA8 study environment built with Vagrant/Ansible
Stars: ✭ 108 (-94.49%)
Mutual labels:  ansible, vagrant
Forklift
Helpful deployment scripts for Foreman and Katello
Stars: ✭ 141 (-92.8%)
Mutual labels:  ansible, vagrant

Ansible tutorial

This tutorial presents Ansible step-by-step. You'll need to have a (virtual or physical) machine to act as an Ansible node. A Vagrant environment is provided for going through this tutorial.

Ansible is a configuration management software that lets you control and configure nodes from another machine. What makes it different from other management software is that Ansible uses (potentially existing) SSH infrastructure, while others (Chef, Puppet, ...) need a specific PKI infrastructure to be set up.

Ansible also emphasizes push mode, where configuration is pushed from a master machine (a master machine is only a machine where you can SSH to nodes from) to nodes, while most other CM typically do it the other way around (nodes pull their config at times from a master machine).

This mode is really interesting since you do not need to have a 'publicly' accessible 'master' to be able to configure remote nodes: it's the nodes that need to be accessible (we'll see later that 'hidden' nodes can pull their configuration too!), and most of the time they are.

This tutorial has been tested with Ansible 2.9.

We're also assuming you have a keypair in your ~/.ssh directory.

Quick start

  • install Vagrant if you don't have it
  • install ansible (preferably 2.10.5+ and using pip+virtualenv)
  • vagrant up
  • goto step-00

Complete explanations

Installing Ansible

The reference is the installation guide, but I strongly recommend the Using pip & virtualenv (higly recommended !) method.

Using pip & virtualenv (higly recommended !)

The best way to install Ansible (by far) is to use pip and virtual environments.

Using virtualenv will let you have multiple Ansible versions installed side by side, and test upgrades or use different versions in different projects. Also, by using a virtualenv, you won't pollute your system's python installation.

Check virtualenvwrapper for this. It makes managing virtualenvs very easy.

Under Ubuntu, installing virtualenv & virtualenvwrapper can be done like so:

sudo apt install python3-virtualenv virtualenvwrapper python3-pip
exec $SHELL

You can then create a virtualenv:

mkvirtualenv ansible-tuto
workon ansible-tuto

(mkvirtualenv usually switches you automatically to your newly created virtualenv, so here workon ansible-tuto is not strictly necessary, but lets be safe).

Then, install ansible via pip:

pip install ansible==2.7.1

(or use whatever version you want).

When you're done, you can deactivate your virtualenv to return to your system's python settings & modules:

deactivate

If you later want to return to your virtualenv:

workon ansible-tuto

Use lsvirtualenv to list all your virtual environments.

From source (if you want to hack on ansible source code)

Ansible devel branch is always usable, so we'll run straight from a git checkout. You might need to install git for this (sudo apt-get install git on Debian/Ubuntu).

git clone git://github.com/ansible/ansible.git
cd ./ansible

At this point, we can load the Ansible environment:

source ./hacking/env-setup

From a distribution package (discouraged)

sudo apt-get install ansible

From a built deb package (discouraged)

When running from an distribution package, this is absolutely not necessary. If you prefer running from an up to date Debian package, Ansible provides a make target to build it. You need a few packages to build the deb and few dependencies:

sudo apt-get install make fakeroot cdbs python-support python-yaml python-jinja2 python-paramiko python-crypto python-pip
git clone git://github.com/ansible/ansible.git
cd ./ansible
make deb
sudo dpkg -i ../ansible_x.y_all.deb (version may vary)

Cloning the tutorial

git clone https://github.com/leucos/ansible-tuto.git
cd ansible-tuto

Running the tutorials interactively with Docker

You can run the tutorials here interactively including a very simple setup with docker.

Check this repository for details.

Using Vagrant with the tutorial

It's highly recommended to use Vagrant to follow this tutorial. If you don't have it already, setting up should be quite easy and is described in step-00/README.md.

If you wish to proceed without Vagrant (not recommended!), go straight to step-01/README.md.

Contents

Terminology:

  • command or action: ansible module executed in stand-alone mode. Intro in step-02.
  • task: combines an action (a module and its arguments) with a name and optionally some other keywords (like looping directives).
  • play: a yaml structure executing a list of roles or tasks over a list of hosts
  • playbook: yaml file containing multiple plays. Intro in step-04.
  • role: an organisational unit grouping tasks together in order to achieve something (install a piece of software for instance). Intro in step-12.

Just in case you want to skip to a specific step, here is a topic table of contents.

Contributing

Thanks to all people who have contributed to this tutorial:

(and sorry if I forgot anyone)

I've been using Ansible almost since its birth, but I learned a lot in the process of writing it. If you want to jump in, it's a great way to learn, feel free to add your contributions.

The chapters being written live in the writing branch.

If you have ideas on topics that would require a chapter, please open a PR.

I'm also open on pairing for writing chapters. Drop me a note if you're interested.

If you make changes or add chapters, please fill the test/expectations file and run the tests (test/run.sh). See the test/run.sh file for (a bit) more information.

When adding a new chapter (e.g. step-NN), please issue:

cd step-99
ln -sf ../step-NN/{hosts,roles,site.yml,group_vars,host_vars} .

For typos, grammar, etc... please send a PR for the master branch directly.

Thank you!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].