Ansible role to pack projects from git repositories into deb packages and make then available as debian software channel (to install with apt-get).
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
meta
tasks
templates
README.md

README.md

package_server

A role to pack projects from git repositories into deb packages, and make then available as a debian channel (to install with apt-get).

variables

  • eher_package_server_host - host that the debian channel will be available
  • eher_package_server_port - port that the debian channel will listen
  • eher_package_server_build_path - path used to build projects
  • eher_package_server_name - name of the generated deb package
  • eher_package_server_git_repo - git repository that have the project to be packed
  • eher_package_server_build_command - command that will be executed on project root, before pack it
  • eher_package_server_destination_prefix - path to where the project will be extracted on package installation (default is /usr/local/<eher_package_server_name>)
  • package_server_after_install_command - command to be executed after package install

how it works?

Fisrt of all configure the basic of your package server.

---
# group_vars/package_server
eher_package_server_host: localhost
eher_package_server_port: 80
eher_package_server_build_path: /tmp/packages

Then you can configure some packages. A definition of a package is git repository and a package name. You can also define witch git branch will be usedi, a command to be executed into project root before be packed and path to where the package will be installed.

---
# site.yml
- hosts: package_server
  sudo: yes
  tags: package_server
  roles:
      - role: EHER.package_server
        eher_package_server_name: 'queroservoluntario'
        eher_package_server_git_repo: '/home/git/queroservoluntario.git'
        eher_package_server_git_branch: 'Eher'
        eher_package_server_build_command: 'make install'
        eher_package_server_destination_prefix: '/var/www/queroservoluntario'

Before run the role will be available a command to pack the project. In the example will be pack_queroservoluntario.sh, because the eher_package_name set.

pack_queroservoluntario.sh

It will generate a queroservoluntario.deb into /var/www/packages and updated the channel index Packages.gz.

Now you can add the channel into your apt sources, update the apt cache and install with apt-get.

sudo apt-add-repository 'deb http://localhost:80 /'
sudo apt-get update
sudo apt-get install queroservoluntario

You can also use the package_client role and make it simpler.