puz2eq
Last Updated: February 25, 2016
·
1.123K
· ramondelafuente
24ef80339ca19df482961c1571cda607

Replacing Capistrano with Ansible

If you currently deploy your project with Capistrano but you've started provisioning with Ansible, try replacing Capistrano altogether with this Ansible role in the Galaxy:

Project Deploy

https://galaxy.ansible.com/list#/roles/732

An example playbook for deployments (for a Symfony Project) would look as simple as:

---
- name: Deploy the application
  hosts: production
  remote_user: "{{ production_deploy_user }}"
  sudo: no

  vars:
    project_root: "/path/to/root"
    project_git_repo: "https://github.com/user/repo"
    project_deploy_strategy: git

    project_environment:
      SYMFONY_ENV: "prod"

    project_shared_children:
      - path: "/app/sessions"
        src: "sessions"
      - path: "/web/uploads"
        src: "uploads"

    project_templates:
      - name: parameters.yml
        src: "templates/parameters.yml.j2"
        dest: "/app/config/parameters.yml"

    project_has_composer: yes

    project_post_build_commands:
      - "app/console cache:clear"
      - "app/console doctrine:migrations:migrate --no-interaction"
      - "app/console assets:install"
      - "app/console assetic:dump"

  roles:
    - f500.project_deploy

This example was taken from https://github.com/SweetLakePHP/SweetLakePHP


Or, if you're feeling bold, try writing your own role based on the deploy_helper module yourself:

Project Deploy Module

https://galaxy.ansible.com/list#/roles/2266

Say Thanks
Respond
Filed Under