项目作者: Tocyuki

项目描述 :
Server Provisioning with Ansible, Vagrant and Packer.
高级语言:
项目地址: git://github.com/Tocyuki/ansible-playbook-template.git
创建时间: 2020-05-20T00:38:13Z
项目社区:https://github.com/Tocyuki/ansible-playbook-template

开源协议:MIT License

下载


Ansible Playbook Template

Server Provisioning with Ansible, Vagrant and Packer.

Feature

  • Local environment is Vagrant.
  • Execute Ansible and Packer with docker-compose.
  • Test with Testinfra.
  • Create AMI on AWS with Packer.
  • Execute server provisioning with Ansible.

Requirements

  • docker
  • docker-compose
  • vagrant
  • virtualbox

Advance preparation

Vagrant Integration

If you want to test Vagrant machine from your own terminal, execute the following command.

  1. $ pip install testinfra paramiko
  2. $ vagrant ssh-config > .vagrant/ssh-config
  3. $ py.test -v --hosts=web --ssh-config=.vagrant/ssh-config tests

Usage

Local execute with Vagrant

up

  1. $ vagrant up web

provision

  1. $ vagrant provision web

ssh

  1. $ vagrant ssh web

Create AMI on AWS with Packer

lint

  1. $ docker-compose run --rm packer validate packer/web.json

inspect

  1. $ docker-compose run --rm packer inspect packer/web.json

build

  1. $ docker-compose run --rm packer build packer/web.json

Run Ansible Playbook

lint

  1. $ docker-compose run --rm ansible-playbook -i inventory web.yml --syntax-check

run

  1. $ docker-compose run --rm ansible-playbook -i inventory web.yml