freedomofpress.build-debian-package

Building a Debian Package with Ansible

This Ansible role helps you create Debian packages from local files. You can set up the package details using simple variables.

Role Variables

build_debian_package_local_directory: build

# This specifies the directory from which files will be copied 
# into the build directory. The structure of the folders is kept the same.
# You can list the directories to be synchronized. Use dicts with "src" 
# and "dest." Set "dest" to an empty string to move files directly to the 
# build directory.
build_debian_package_files_directories: []

# Use this for single files that need to be copied. Again, use a dict 
# with "src" and "dest."
build_debian_package_extra_files: []

build_debian_package_base_dependencies:
  - build-essential
  - gcc-4.8
  - make

# These are files that will be deleted from the package before building.
# It's safer to remove them in a separate task instead of using an rsync filter.
build_debian_package_unwanted_files: []

# List any extra system packages needed for building the package.
build_debian_package_extra_dependencies: []

# These are the DEBIAN/control fields for your package. Some are required, 
# and some are recommended. Check here for more info: 
# https://www.debian.org/doc/debian-policy/ch-controlfields.html
# Note: Fields like Conflicts, Depends, and Removes need to be lists, not strings.
build_debian_package_control_fields:
  Package: dummy-package
  Version: 0.1
  Priority: optional
  Architecture: amd64
  Maintainer: SomeOrganization
  Description: This is an empty Debian package.

# Where the build files will be stored.
build_debian_package_directory: /tmp/{{ build_debian_package_control_fields.Package }}-{{ build_debian_package_control_fields.Version }}-{{ build_debian_package_control_fields.Architecture }}
build_debian_package_deb_file: "{{ build_debian_package_directory }}.deb"

# For pip wheel archives. This is skipped by default. 
# These paths should relate to the Debian package files, 
# which will be combined with the build directory.
build_debian_package_pip_requirements: ""
build_debian_package_pip_wheel_directory: ""

# Set ownership of files before building. This uses rsync flags 
# in the `synchronize` module. The default owner is "root," 
# based on system packages. chmod options set permissions to D755 and Fo-w.
build_debian_package_owner_username: root
build_debian_package_group_username: root

Example Playbook

- name: Build Debian package
  hosts: buildserver
  become: yes
  vars:
    deb_package_dependencies:
      - emacs
      - vim
  roles:
    - role: freedomofpress.build-debian-package
      build_debian_package_control_fields:
        Package: wizard-hat
        Version: 0.7.2
        Priority: optional
        Architecture: amd64
        Depends: "{{ deb_package_dependencies|join(',') }}"
        Maintainer: Yours Truly
        Description: A wizard's true power lies in knowing the names of things.
      tags: build

In this example, we only specify dependencies and no files, creating a metapackage.

Further Reading

Here are some helpful resources that assisted in creating this role:

License

MIT

Informazioni sul progetto

Build a generic Debian package

Installa
ansible-galaxy install freedomofpress.build-debian-package
Licenza
Unknown
Download
98
Proprietario
Defending and supporting cutting-edge transparency journalism in the face of adversity.