Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

manala/ansible-role-deploy

Repository files navigation

#######################################################################################################

❗ DEPRECATION ❗

This repository and the role associated are deprecated in favor of the Manala Ansible Collection

You will find informations on its usage on the collection repository

#######################################################################################################

Ansible Role: Deploy Build Status

Report issues and send Pull Requests in the main Ansible Role repository

This role will deal with Deployment.

It's part of the Manala Ansible stack but can be used as a stand alone component.

Requirements

None.

Dependencies

None.

Installation

Ansible 2+

Using ansible galaxy cli:

ansible-galaxy install manala.deploy

Using ansible galaxy requirements file:

- src: manala.deploy

Role Variables

Name Default Type Description

Strategies

Include strategy

The include strategy allows to use a custom strategy to deliver the code to the server.

Example that extracts an archive from AWS S3:

manala_deploy_strategy: include
manala_deploy_strategy_include_name: "{{ playbook_dir }}/tasks/deploy-s3-archive.yml"
manala_deploy_strategy_include_options:
  s3_object: "/app/{{ app_version | default('master') }}/latest.tar.gz"

tasks/deploy-s3-archive.yml

- name: strategy/s3
  block:
    - name: strategy/s3 > Create tmp dir
      tempfile:
        state: directory
        suffix: manala_deploy
      register: deploy_tmp

    - name: strategy/s3 > Get S3 archive
      aws_s3:
        bucket: releases
        object: "{{ manala_deploy_strategy_include_options.s3_object }}"
        dest: "{{ deploy_tmp.path }}/archive.tar.gz"
        mode: get

    - name: strategy/s3 > Create release dir
      file:
        path: "{{ deploy_helper.new_release_path }}/"
        state: directory

    - name: strategy/s3 > Unarchive
      unarchive:
        src: "{{ deploy_tmp.path }}/archive.tar.gz"
        dest: "{{ deploy_helper.new_release_path }}"
        remote_src: yes

Tasks

Without options

manala_deploy_tasks:
  - foo
  - foo:  ~
    when: "'deploy_demo_master' in group_names"

Single or default option

manala_deploy_tasks:
  - foo: bar
  - foo: bar
    when: "'deploy_demo_master' in group_names"

Multiple options

manala_deploy_tasks:
  - foo:
      baz: bar
      bar: baz
  - foo:
      baz: bar
      bar: baz
    when: "'deploy_demo_master' in group_names"

Example playbook

- hosts: servers
  roles:
    - { role: manala.deploy }

Licence

MIT

Author information

Manala (http://www.manala.io/)