321 Create package repository configuration
Use case
Use the role vbotka.freebsd.packages to create a package’ repository configuration.
Tree
shell> tree .
.
├── ansible.cfg
├── files
│ └── build.example.com-sk.crt
├── host_vars
│ └── iocage_04
│ └── repos.yml
├── iocage.ini
└── pb-repos.yml
Synopsis
At the managed node iocage_04 in the playbook pb-repos.yml create the package’ repository
configuration.
Requirements
TBD
Notes
TBD
Note
vbotka.freebsd.packages is the role packages in the collection vbotka.freebsd.
vbotka.freebsd_packages is the role freebsd_packages in the namespace vbotka.
Please make sure the versions are the same before you switch between them.
ansible.cfg
[defaults]
gathering = explicit
callback_result_format = yaml
display_skipped_hosts = false
[connection]
pipelining = true
Inventory iocage.ini
iocage_04 ansible_host=10.1.0.29
[iocage]
iocage_04
[iocage:vars]
ansible_user=admin
ansible_become=true
ansible_python_interpreter=auto_silent
host_vars
host_vars/iocage_04/repos.yml
pkg_keys:
/usr/local/etc/ssl/crt:
- build.example.com-sk.crt
pkg_repos_conf:
- name: build
conf:
- {key: url, value: '"http://10.1.0.195/packages/143amd64-default-devel"'}
- {key: enabled, value: 'yes'}
- {key: signature_type, value: '"pubkey"'}
- {key: pubkey, value: '"/usr/local/etc/ssl/crt/build.example.com-sk.crt"'}
Playbook pb.yml
- name: Role vbotka.freebsd.packages
hosts: iocage
gather_facts: true
roles:
- vbotka.freebsd.packages
Playbook output - Create repo
shell> ansible-playbook pb.yml -i iocage.ini -t pkg_keys,pkg_conf
PLAY [Role vbotka.freebsd.packages] ********************************************
TASK [Gathering Facts] *********************************************************
ok: [iocage_04]
TASK [vbotka.freebsd.packages : Vars: Set the lists for amd64] *****************
ok: [iocage_04]
TASK [vbotka.freebsd.packages : Keys: Create directories.] *********************
ok: [iocage_04] => (item=/usr/local/etc/ssl/crt)
TASK [vbotka.freebsd.packages : Keys: Copy keys.] ******************************
ok: [iocage_04] => (item=/usr/local/etc/ssl/crt/build.example.com-sk.crt)
TASK [vbotka.freebsd.packages : Conf: Create directories] **********************
ok: [iocage_04] => (item=/usr/local/etc/pkg)
ok: [iocage_04] => (item=/usr/local/etc/pkg/repos)
TASK [vbotka.freebsd.packages : Conf: Configure /usr/local/etc/pkg/repos] ******
ok: [iocage_04] => (item=build)
PLAY RECAP *********************************************************************
iocage_04 : ok=6 changed=0 unreachable=0 failed=0 skipped=9 rescued=0 ignored=0
Repository build.conf at iocage_04
/usr/local/etc/pkg/repos/build.conf
# Ansible managed
build: {
url: "http://10.1.0.195/packages/143amd64-default-devel",
enabled: yes,
signature_type: "pubkey",
pubkey: "/usr/local/etc/ssl/crt/build.example.com-sk.crt"
}
# EOF
Configuration at iocage_04
[iocage_04]# pkg -vv
Version : 2.2.2
libpkg : 2.2.2
libcurl : libcurl/8.14.1 OpenSSL/3.0.16 zlib/1.3.1
libarchive : libarchive 3.7.7
sqlite : 3.50.1
openssl : OpenSSL 3.0.16 11 Feb 2025
PKG_DBDIR = "/var/db/pkg";
PKG_CACHEDIR = "/var/cache/pkg";
PORTSDIR = "/usr/ports";
INDEXDIR = "";
INDEXFILE = "INDEX-14";
HANDLE_RC_SCRIPTS = false;
DEFAULT_ALWAYS_YES = false;
ASSUME_ALWAYS_YES = false;
REPOS_DIR [
"/etc/pkg/",
"/usr/local/etc/pkg/repos/",
]
PLIST_KEYWORDS_DIR = "";
SYSLOG = true;
DEVELOPER_MODE = false;
VULNXML_SITE = "https://vuxml.freebsd.org/freebsd/vuln.xml.xz";
FETCH_RETRY = 3;
PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [
]
DEBUG_SCRIPTS = false;
PLUGINS_CONF_DIR = "/usr/local/etc/pkg/";
PERMISSIVE = false;
REPO_AUTOUPDATE = true;
NAMESERVER = "";
HTTP_USER_AGENT = "pkg/2.2.2";
EVENT_PIPE = "";
FETCH_TIMEOUT = 30;
UNSET_TIMESTAMP = false;
SSH_RESTRICT_DIR = "";
PKG_ENV {
}
PKG_SSH_ARGS = "";
DEBUG_LEVEL = 0;
ALIAS {
all-depends = "query %dn-%dv";
annotations = "info -A";
build-depends = "info -qd";
cinfo = "info -Cx";
comment = "query -i \"%c\"";
csearch = "search -Cx";
desc = "query -i \"%e\"";
download = "fetch";
iinfo = "info -ix";
isearch = "search -ix";
prime-list = "query -e '%a = 0' '%n'";
prime-origins = "query -e '%a = 0' '%o'";
leaf = "query -e '%#r == 0' '%n-%v'";
list = "info -ql";
noauto = "query -e '%a == 0' '%n-%v'";
options = "query -i \"%n - %Ok: %Ov\"";
origin = "info -qo";
orphans = "version -vRl?";
provided-depends = "info -qb";
rall-depends = "rquery %dn-%dv";
raw = "info -R";
rcomment = "rquery -i \"%c\"";
rdesc = "rquery -i \"%e\"";
required-depends = "info -qr";
roptions = "rquery -i \"%n - %Ok: %Ov\"";
shared-depends = "info -qB";
show = "info -f -k";
size = "info -sq";
unmaintained = "query -e '%m = \"ports@FreeBSD.org\"' '%o (%w)'";
runmaintained = "rquery -e '%m = \"ports@FreeBSD.org\"' '%o (%w)'";
}
CUDF_SOLVER = "";
SAT_SOLVER = "";
RUN_SCRIPTS = true;
CASE_SENSITIVE_MATCH = false;
LOCK_WAIT = 1;
LOCK_RETRIES = 5;
SQLITE_PROFILE = false;
WORKERS_COUNT = 0;
READ_LOCK = false;
IP_VERSION = 0;
AUTOMERGE = true;
MERGETOOL = "";
VERSION_SOURCE = "";
CONSERVATIVE_UPGRADE = true;
FORCE_CAN_REMOVE_VITAL = true;
PKG_CREATE_VERBOSE = false;
AUTOCLEAN = false;
DOT_FILE = "";
REPOSITORIES {
}
VALID_URL_SCHEME [
"pkg+http",
"pkg+https",
"https",
"http",
"file",
"ssh",
"tcp",
]
WARN_SIZE_LIMIT = 1048576;
METALOG = "";
IGNORE_OSVERSION = false;
BACKUP_LIBRARIES = false;
BACKUP_LIBRARY_PATH = "/usr/local/lib/compat/pkg";
PKG_TRIGGERS_DIR = "/usr/local/share/pkg/triggers";
PKG_TRIGGERS_ENABLE = true;
AUDIT_IGNORE_GLOB [
]
AUDIT_IGNORE_REGEX [
]
COMPRESSION_FORMAT = "";
COMPRESSION_LEVEL = -1;
ARCHIVE_SYMLINK = false;
REPO_ACCEPT_LEGACY_PKG = false;
FILES_IGNORE_GLOB [
]
FILES_IGNORE_REGEX [
]
SHLIB_PROVIDE_PATHS_NATIVE [
]
SHLIB_PROVIDE_PATHS_COMPAT_32 [
]
SHLIB_PROVIDE_PATHS_COMPAT_LINUX [
]
SHLIB_PROVIDE_PATHS_COMPAT_LINUX_32 [
]
SHLIB_PROVIDE_IGNORE_GLOB [
]
SHLIB_PROVIDE_IGNORE_REGEX [
]
SHLIB_REQUIRE_IGNORE_GLOB [
]
SHLIB_REQUIRE_IGNORE_REGEX [
]
PKG_DEBUG_FLAGS [
"all",
]
COMPRESSION_THREADS = -1;
PKG_REINSTALL_ON_OPTIONS_CHANGE = true;
TRACK_LINUX_COMPAT_SHLIBS = false;
ABI = "FreeBSD:14:amd64";
ALTABI = "freebsd:14:x86:64";
OSVERSION = "1403000";
Repositories:
FreeBSD: {
url : "pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly",
enabled : yes,
priority : 0,
mirror_type : "SRV",
signature_type : "FINGERPRINTS",
fingerprints : "/usr/share/keys/pkg"
}
FreeBSD-kmods: {
url : "pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/kmods_quarterly_3",
enabled : yes,
priority : 0,
mirror_type : "SRV",
signature_type : "FINGERPRINTS",
fingerprints : "/usr/share/keys/pkg"
}
build: {
url : "http://10.1.0.195/packages/143amd64-default-devel",
enabled : yes,
priority : 0,
signature_type : "PUBKEY",
pubkey : "/usr/local/etc/ssl/crt/build.example.com-sk.crt"
}
Update repos at iocage_04
[iocage_04]# pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.conf: . done
Fetching data.pkg: .......... done
Processing entries: .......... done
FreeBSD repository update completed. 35665 packages processed.
Updating FreeBSD-kmods repository catalogue...
Fetching meta.conf: . done
Fetching data.pkg: .. done
Processing entries: .......... done
FreeBSD-kmods repository update completed. 210 packages processed.
Updating build repository catalogue...
repository build has no meta file, using default settings
Unable to update repository build
Error updating repositories!