ervinismu / ansible-molecule-blankon

deploy static website with ansible

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Molecule

Create and testing ansible role using Molecule and serverspec

Dependency

  • virtualbox
  • vagrant
  • python pip
  • ansible
  • serverspec (verifier)

Install molecule-dep

$ apt-get update
$ apt-get install gcc python-pip python-vagrant libssl-dev libffi-dev

Install Molecule using pip:

$ pip install ansible
$ pip install docker-py
$ pip install molecule

How to use

$ molecule --help | to show others command
$ molecule init --role nginx --verifier serverspec | create new rule from scratch using serverspec for verifier
$ bundle install

Addition setup

We using debian jessie64, so please edit platform section in molecule.yml

platforms:
    - name: debian/jessie64
      box: debian/jessie64
      box_url: https://vagrantcloud.com/debian/boxes/jessie64/versions/8.7.0/providers/virtualbox.box

Testing

$ molecule test --destroy=always | start testing
More about serverspec testing can be found at serverspec.org

Debug

$ ssh ubuntu@127.0.0.1 -p 2222 -i $(pwd)/nginx/.vagrant/machines/nginx/virtualbox/private_key

Implement v1

hosts file need create manual, and make sure public key configured
$ ansible-playbook nginx/playbook.yml -i nginx/hosts --private-key ~/.ssh/id_rsa --user ubuntu

Implement v2

$ ansible-playbook nginx/playbook.yml -i nginx/environment/staging --private-key ~/.ssh/id_rsa --user ubuntu

Documentations

Documentations video klik link :

About

deploy static website with ansible

License:MIT License


Languages

Language:Ruby 100.0%