don_rumata.ansible_role_install_aptly

Ansible角色:安装Aptly

许可证 Ansible Galaxy Ansible Galaxy质量

在Debian或Ubuntu上安装Aptly

支持的平台

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

需求

[min_ansible_version: 2.8]

角色变量

#--- 主要部分 ---#
aptly_repo_version: stable
# aptly_repo_version: unstable

aptly_path_to_local_repo: /var/aptly

aptly_user: aptly

aptly_group: aptly

#--- API部分 ---#
aptly_run_api_service: true
# aptly_run_api_service: false

aptly_api_port: 8080

aptly_api_service_name: aptly-api

#--- 第一个仓库部分 ---#
aptly_my_first_repo_create: true
# aptly_create_my_first_repo: false

aptly_my_first_repo_create_over: api
# 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: 通过https://github.com/don-rumata/ansible-role-install-aptly生成的仓库

aptly_my_first_repo_component: main
# aptly_my_first_repo_component: contrib
# aptly_my_first_repo_component: non-free

#--- 创建仓库中的软件部分 ---#
aptly_add_first_software_in_created_repo: false

#--- GPG部分 ---#
aptly_gpg_key_generate: true
# aptly_gpg_key_generate: false

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

aptly_gpg_key_comment: 带有愚蠢的密码短语

aptly_gpg_key_type: RSA

aptly_gpg_key_length: 4096

#--- www部分 ---#
aptly_www_access: true
# aptly_www_access: false

aptly_www_webdav_access: true
# aptly_www_webdav_access: false

aptly_www_module_name: deb

aptly_www_port: 80

aptly_www_backend: nginx
# aptly_www_backend: lighttpd
# aptly_www_backend: apache

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

#--- rsync部分 ---#
aptly_rsync_access: true
# aptly_rsync_access: false

aptly_rsync_module_name: deb

aptly_rsync_local_path: '{{ aptly_path_to_local_repo }}/public'

#--- ftp部分 ---#
aptly_ftp_access: true
# aptly_ftp_access: false

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部分 ---#
aptly_nfs_access: true
# aptly_nfs_access: false

依赖关系

无。

示例剧本

安装稳定版本aptly,包括:

  • 为aptly创建服务用户
  • 安装并配置aptly api守护进程
  • 创建“Hello, World!”仓库
  • 生成gpg密钥以签署仓库(警告!!! 没有密码短语!!!)
  • 通过(所有访问为只读)共享仓库:
    • http(nginx)
    • webdav(nginx)
    • rsync(rsyncd)
    • ftp(vsftpd)
    • nfs(nfs-kernel-server)

install-aptly.yml

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

安装稳定版本aptly,没有所有功能:

- name: 安装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:

安装稳定版本aptly,通过cli创建仓库并通过apache在端口83共享仓库:

- name: 安装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:

在Debian或Ubuntu上添加仓库

10.10.10.10 - 示例IP。

通过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 -

通过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 -

通过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

要永久挂载:

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

通过webdav

即将推出

完成后

sudo apt update

许可证

Apache许可证,版本2.0

作者信息

don Rumata

待办事项

  • 添加测试。
  • 添加aptly_create_gpg_pass: true\false
  • 添加webdav的示例。
关于项目

Install Aptly on Debian or Ubuntu.

安装
ansible-galaxy install don_rumata.ansible_role_install_aptly
许可证
apache-2.0
下载
673
拥有者
Здесь все бесполезно. Знаний не хватает, а золото теряет цену, потому что опаздывает.