This guide provides a full Ansible playbook to install Aptly on Debian/Ubuntu systems.
Note: Aptly is Debian/Ubuntu specific and is not available on RHEL systems. Installation is via binary download or third-party repository, not distro packages.
- name: Install Aptly
hosts: aptly
become: true
vars:
aptly_version: "1.5.0"
aptly_arch: "linux_amd64"
aptly_install_dir: /usr/local/bin
aptly_config_dir: /etc/aptly
tasks:
- name: Install prerequisites
apt:
name:
- gnupg
- curl
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Download Aptly binary
get_url:
url: "https://github.com/aptly-dev/aptly/releases/download/v{{ aptly_version }}/aptly_{{ aptly_version }}_{{ aptly_arch }}.tar.gz"
dest: "/tmp/aptly_{{ aptly_version }}.tar.gz"
mode: "0644"
register: download_result
- name: Extract Aptly binary
unarchive:
src: "/tmp/aptly_{{ aptly_version }}.tar.gz"
dest: "{{ aptly_install_dir }}"
remote_src: true
mode: "0755"
when: download_result.changed
- name: Create configuration directory
file:
path: "{{ aptly_config_dir }}"
state: directory
mode: "0755"
- name: Create default configuration
copy:
dest: "{{ aptly_config_dir }}/aptly.conf"
content: |
{
"rootDir": "/var/lib/aptly"
}
mode: "0644"
when: download_result.changed
- name: Create data directory
file:
path: /var/lib/aptly
state: directory
mode: "0755"
owner: root
group: root
- name: Verify binary is available
command: "aptly --version"
register: app_version
changed_when: false
failed_when: false
- name: Show detected version output
debug:
var: app_version.stdout
You can use the community-maintained puppet/aptly role:
- name: Install Aptly using community role
hosts: aptly
become: true
roles:
- role: puppet/aptly
vars:
aptly_version: "1.5.0"
aptly api serve) can be run manually or via systemd if needed.We develop tailored automation solutions for:
Let’s discuss your requirements: office@linux-server-admin.com | Contact
References: