don_rumata.ansible_role_install_aptly

Ansible Role: Install Aptly

License Ansible Galaxy Ansible Galaxy Quality

This guide will help you install Aptly on Debian or Ubuntu.

Supported Platforms

  platforms:
    - name: Ubuntu
      versions:
        - xenial
        - bionic
        - focal
    - name: Debian
      versions:
        - oldstable
        - stable
        - testing

Requirements

  • Minimum Ansible version: 2.8

Role Variables

#--- Main Settings ---#
# Choose between stable or unstable version
aptly_repo_version: stable
# Uncomment for unstable version
# aptly_repo_version: unstable

aptly_path_to_local_repo: /var/aptly

aptly_user: aptly

aptly_group: aptly

#--- API Settings ---#
aptly_run_api_service: true
# Set to false if you don’t need the API

aptly_api_port: 8080

aptly_api_service_name: aptly-api

#--- First Repository Settings ---#
aptly_my_first_repo_create: true
# Set to false if you don’t want to create the first repo

# Method to create the first repository
aptly_my_first_repo_create_over: api
# Switch to cli if needed
# aptly_my_first_repo_create_over: cli

aptly_my_first_repo_name: my-first-repo

aptly_my_first_repo_distribution: rolling

aptly_my_first_repo_comment: Repo generated with https://github.com/don-rumata/ansible-role-install-aptly

aptly_my_first_repo_component: main
# Uncomment for other components
# aptly_my_first_repo_component: contrib
# aptly_my_first_repo_component: non-free

#--- Software in Created Repository ---#
aptly_add_first_software_in_created_repo: false # Set true to add software

#--- GPG Settings ---#
aptly_gpg_key_generate: true
aptly_gpg_key_path: '{{ aptly_path_to_local_repo }}/gpg'
aptly_gpg_publickey_filename: repo.key
aptly_gpg_key_maintainer: Jon Doe
aptly_gpg_key_email: [email protected]
aptly_gpg_key_expire_date: 365
aptly_gpg_key_pass: qazwsxedc # Warning! Use a secure passphrase
aptly_gpg_key_comment: with stupid passphrase
aptly_gpg_key_type: RSA
aptly_gpg_key_length: 4096

#--- Web Access Settings ---#
aptly_www_access: true
aptly_www_webdav_access: true

aptly_www_module_name: deb
aptly_www_port: 80
aptly_www_backend: nginx

aptly_www_local_path: /var/www/{{ aptly_www_module_name }}

#--- Rsync Access ---#
aptly_rsync_access: true
aptly_rsync_module_name: deb
aptly_rsync_local_path: '{{ aptly_path_to_local_repo }}/public'

#--- FTP Access ---#
aptly_ftp_access: true
aptly_ftp_module_name: deb
aptly_ftp_anon_root_dir: /srv/ftp
aptly_ftp_local_path: '{{ aptly_ftp_anon_root_dir }}/{{ aptly_ftp_module_name }}'

#--- NFS Access ---#
aptly_nfs_access: true

Dependencies

None.

Example Playbook

To install the stable version of aptly:

  • Creates a user for aptly
  • Installs and configures the aptly API
  • Creates a "Hello, World!" repository
  • Generates GPG keys for signing the repository (WARNING: WITHOUT A PASSPHRASE)
  • Shares the repository with read-only access via:
    • HTTP (nginx)
    • WebDAV (nginx)
    • rsync (rsyncd)
    • FTP (vsftpd)
    • NFS (nfs-kernel-server)

install-aptly.yml:

- name: Install Aptly
  hosts: all
  strategy: free
  serial:
    - "100%"
  roles:
    - ansible-role-install-aptly
  tasks:

To install the unstable version of aptly without additional features:

- name: Install Aptly
  hosts: all
  strategy: free
  serial:
    - "100%"
  roles:
    - ansible-role-install-aptly
  vars:
    aptly_repo_version: unstable
    aptly_run_api_service: false
    aptly_create_my_first_repo: false
    aptly_add_first_software_in_created_repo: false
    aptly_gpg_key_generate: false
    aptly_www_access: false
    aptly_www_webdav_access: false
    aptly_rsync_access: false
    aptly_ftp_access: false
    aptly_nfs_access: false
  tasks:

To install the stable version, create a repository via CLI, and share an empty repository over Apache on port 83:

- name: Install Aptly
  hosts: all
  strategy: free
  serial:
    - "100%"
  roles:
    - ansible-role-install-aptly
  vars:
    aptly_run_api_service: false
    aptly_create_my_first_repo: true
    aptly_my_first_repo_create_over: cli
    aptly_add_first_software_in_created_repo: false
    aptly_gpg_key_generate: false
    aptly_www_access: true
    aptly_www_backend: apache
    aptly_www_webdav_access: false
    aptly_www_port: 83
    aptly_rsync_access: false
    aptly_ftp_access: false
    aptly_nfs_access: false
  tasks:

Add Your Repository in Debian/Ubuntu

Example IP: 10.10.10.10

Over HTTP

echo "deb http://10.10.10.10/deb rolling main" | sudo tee --append /etc/apt/sources.list.d/my-awesome-repo.list
wget -q -O - http://10.10.10.10/deb/repo.key | sudo apt-key add -

Over FTP

echo "deb ftp://10.10.10.10/deb rolling main" | sudo tee --append /etc/apt/sources.list.d/my-awesome-repo.list
wget -q -O - ftp://10.10.10.10/deb/repo.key | sudo apt-key add -

Over NFS

sudo mkdir /var/repo
mount.nfs 10.10.10.10:/var/aptly/public /var/repo
echo "deb file:/var/repo rolling main" | sudo tee --append /etc/apt/sources.list.d/my-awesome-repo.list
sudo apt-key add /var/repo/repo.key

For permanent mount:

echo "10.10.10.10:/var/aptly/public /var/repo nfs noatime,nodiratime 0 0" | sudo tee --append /etc/fstab

After Everything

Run:

sudo apt update

License

Apache License, Version 2.0

Author Information

don Rumata

TODO

  • Add tests.
  • Implement aptly_create_gpg_pass: true\false.
  • Add example for WebDAV.
Informazioni sul progetto

Install Aptly on Debian or Ubuntu.

Installa
ansible-galaxy install don_rumata.ansible_role_install_aptly
Licenza
apache-2.0
Download
673
Proprietario
Здесь все бесполезно. Знаний не хватает, а золото теряет цену, потому что опаздывает.