johnhamelink
8/15/2014 - 11:08 AM

deploy.yml

- hosts: corporate
  user: deploy
  sudo: true
  tasks:
    - name: Install Gem Prerequisites
      apt: pkg={{ item }} state=installed
      with_items:
        - libpq-dev
        - nodejs

- hosts: corporate
  user: deploy
  sudo: true
  vars_files:
    - vars/db.yml
    - vars/nginx.yml
    - vars/repository.yml
    - vars/rails.yml
  vars:
    - consul_services: {
      name: "corporate",
      tags: [],
      port: 80,
      interval: "10s",
      type: 'rails'
    }

  roles:

    # Setup environment variables inside consul
    - { role: consul_set, key: "farmgeek/corporate/db/username", value: "{{ db.username }}" }
    - { role: consul_set, key: "farmgeek/corporate/db/password", value: "{{ db.password }}" }
    - { role: consul_set, key: "farmgeek/corporate/db/name",     value: "{{ db.name     }}" }

    # Clone latest version of repository
    - { role: repository_pull }

    # Run Setup common to most Rails apps
    - { role: rails }

    # Install Unicorn init scripts
    - { role: unicorn }

    # Install Nginx config
    - { role: nginx }

    # Setup a service for consul (to be used by ha_proxy)
    - { role: consul_service }

    # Done!