390 Build packages

Use case

Use the role vbotka.freebsd.poudriere to install poudriere. Build packages.

Tree

shell> tree .
.
├── ansible.cfg
├── hosts
├── host_vars
│   └── build.example.com
│       ├── fp_qemu.yml
│       └── poudriere.yml
├── pb-postinstall.yml
└── pb.yml

Synopsis

Requirements

  • root privilege in the managed node build.example.com.

Notes

  • Building ARM (armv6, armv7, and aarch64) packages on amd64 needs QEMU.

Note

vbotka.freebsd.poudriere is the role poudriere in the collection vbotka.freebsd.
vbotka.freebsd_poudriere is the role freebsd_poudriere in the namespace vbotka.
Please make sure the versions are the same before you switch between them.

ansible.cfg

[defaults]
inventory = $PWD/hosts
gathering = explicit
callback_result_format = yaml
display_skipped_hosts = false

[connection]
pipelining = true

Inventory hosts

build.example.com ansible_host=10.1.0.29

[build]
build.example.com

[build:vars]
ansible_user=admin
ansible_become=true
ansible_python_interpreter=auto_silent

host_vars

host_vars/build.example.com/poudriere.yml
---
poudriere_install: false

# cert
poudriere_cert_cn: build.example.com
poudriere_cert_key: "{{ poudriere_ssl_dir }}/private/{{ poudriere_cert_cn }}.key"
poudriere_cert_csr: "{{ poudriere_ssl_dir }}/csr/{{ poudriere_cert_cn }}.csr"
poudriere_cert_path: "{{ poudriere_ssl_dir }}/certs/{{ poudriere_cert_cn }}.crt"

poudriere_ssl_dirs:
  - "{{ poudriere_ssl_dir }}"
  - "{{ poudriere_ssl_dir }}/csr"
  - "{{ poudriere_ssl_dir }}/crt"
  - "{{ poudriere_ssl_dir }}/certs"

# key
poudriere_key_crt: "{{ poudriere_ssl_dir }}/crt/{{ poudriere_cert_cn }}-sk.crt"
poudriere_conf_pkg_repo_signing_key: "{{ poudriere_ssl_dir }}/private/{{ poudriere_cert_cn }}-sk.key"

# conf
poudriere_conf_no_zfs: "no"
poudriere_conf_template: poudriere.conf2.j2
poudriere_conf_url_base: http://build.example.com
poudriere_conf_use_tmpfs: "no"
poudriere_conf_zpool: iocage
poudriere_conf_zrootfs: /usr/local/poudriere
poudriere_conf_data:
  BASEFS: "{{ poudriere_conf_basefs }}"
  BUILDER_HOSTNAME: "build"
  CHECK_CHANGED_DEPS: "{{ poudriere_conf_check_changed_deps }}"
  CHECK_CHANGED_OPTIONS: "{{ poudriere_conf_check_changed_options }}"
  DISTFILES_CACHE: "{{ poudriere_conf_distfiles_cache }}"
  FREEBSD_HOST: "{{ poudriere_conf_freebsd_host }}"
  NOLINUX: "yes"
  NO_ZFS: "{{ poudriere_conf_no_zfs }}"
  PKG_REPO_SIGNING_KEY: "{{ poudriere_conf_pkg_repo_signing_key }}"
  POUDRIERE_DATA: "{{ poudriere_conf_poudriere_data }}"
  PRESERVE_TIMESTAMP: "yes"
  RESOLV_CONF: "{{ poudriere_conf_resolv_conf }}"
  SVN_HOST: "{{ poudriere_conf_svn_host }}"
  URL_BASE: "{{ poudriere_conf_url_base }}"
  USE_COLORS: "yes"
  USE_PORTLINT: "{{ poudriere_conf_use_portlint }}"
  USE_TMPFS: "{{ poudriere_conf_use_tmpfs }}"
  ZPOOL: "{{ poudriere_conf_zpool }}"
  ZROOTFS: "{{ poudriere_conf_zrootfs }}"

# architecture
poudriere_pkg_arch: [amd64, arm]

# make
poudriere_make_conf:
  - "DEFAULT_VERSIONS+=\t\temacs=nox"
  - "DEFAULT_VERSIONS+=\t\tphp=8.3"
  - "DEFAULT_VERSIONS+=\t\tssl=openssl"
  - "OPTIONS_SET+=\t\t\tGSSAPI_NONE KRB_NONE"
  - "OPTIONS_UNSET+=\t\t\tDOCS NLS X11 EXAMPLES"
  - "OPTIONS_UNSET+=\t\t\tGSSAPI_BASE KRB_BASE KERBEROS"

# pkglist
poudriere_pkglist_all: true
pkglist_enable_amd64: [ansible, minimal]
pkglist_enable_arm: [ansible, minimal]

See also

The variables pkdict_*.yml in the directory defaults/main of the role vbotka.freebsd_postinstall.

host_vars/build.example.com/fp_qemu.yml
fp_qemu: true

fp_qemu_rcvar: qemu_user_static
fp_qemu_user_static_install: true
fp_qemu_user_static_enable: true

fp_packages:
  - {list: qemu, enabled: false}
  - {list: qemu_user_static, enabled: true}

Playbook pb.yml

Limit pkg_dict_* for testing.

- name: Role vbotka.freebsd.poudriere
  hosts: build
  gather_facts: true

  vars:

    pkg_dict_amd64:
      - pkglist: ansible
        packages:
          - sysutils/ansible
          - sysutils/py-ansible-runner
      - pkglist: minimal
        packages:
          - archivers/gtar
          - devel/git
          - ftp/wget
          - net/rsync
          - ports-mgmt/pkg
          - ports-mgmt/portmaster
          - ports-mgmt/portupgrade
          - security/sudo
          - shells/bash

    pkg_dict_arm:
      - pkglist: ansible
        packages:
          - sysutils/ansible
      - pkglist: minimal
        packages:
          - ports-mgmt/pkg
          - shells/bash

  roles:
    - vbotka.freebsd.poudriere

Playbook pb-postinstall.yml

- name: Role vbotka.freebsd.postinstall
  hosts: build
  gather_facts: true

  roles:
    - vbotka.freebsd_postinstall

Playbook output

Build packages

See also