vbotka.freebsd_ports
freebsd_ports
Ansible role. FreeBSD. Install, update, and upgrade ports.
Feel free to share your feedback and report issues.
Requirements
Collections
- community.general
Role Variables
See the defaults end examples in vars.
Workflow
- Change shell on the remote host to /bin/sh if necessary
shell> ansible host -e 'ansible_shell_type=csh ansible_shell_executable=/bin/csh' -a 'sudo pw usermod user -s /bin/sh'
- Install the role and collection
shell> ansible-galaxy role install vbotka.freebsd_ports
Install the collection if necessary
shell> ansible-galaxy collections install community.general
- Fit variables to your needs
Set "freebsd_install_method=ports"
Optionally, get the dictionaries of packages' lists. See:
Put them, for example, into the group_vars/all
shell> ls -1 group_vars/all/
pkgdict_amd64.yml
pkgdict_arm64.yml
pkgdict_arm.yml
pkgdict_i386.yml
pkgdict_versions.yml
- If you update ports-mgmt/portsnap change the path to the configuration file. The default is /etc/portsnap.conf
ports_portsnap_conf_file: /usr/local/etc/portsnap.conf
Also change the cron command. The default is /usr/sbin/portsnap cron
ports_cron_command: /usr/local/sbin/portsnap cron
- Create playbook
shell> cat freebsd-ports.yml
- hosts: srv.example.com
roles:
- vbotka.freebsd_ports
- Manage the ports
Check syntax
shell> ansible-playbook freebsd-ports.yml --syntax-check
Display variables
shell> ansible-playbook freebsd-ports.yml -e ports_debug=true -t ports_debug
Create directories
shell> ansible-playbook freebsd-ports.yml -t ports_dirs
Test sanity
shell> ansible-playbook freebsd-ports.yml -t ports_sanity -e ports_sanity=true
Create configuration
shell> ansible-playbook freebsd-ports.yml -t ports_config
Optionally, update the ports collection (this may take a while)
shell> ansible-playbook freebsd-ports.yml -t ports_update -e ports_update=true -e ports_debug=true
Dry-run the playbook and display changes
shell> ansible-playbook freebsd-ports.yml -e freebsd_install_method=ports --check --diff
Dry-run the ports installation
shell> ansible-playbook freebsd-ports.yml -e ports_dryrun=true -e freebsd_install_method=ports
If all seems to be right manage the ports
shell> ansible-playbook freebsd-ports.yml -e freebsd_install_method=ports
Hint. There are lot of skipped tasks. To make the output of the playbook easier to read:
Use callback plugin community.general.yaml
Disable skipped hosts ANSIBLE_DISPLAY_SKIPPED_HOSTS=false
shell> > ANSIBLE_DISPLAY_SKIPPED_HOSTS=false ansible-playbook freebsd-ports.yml -e freebsd_install_method=ports
Ansible lint
Use the configuration file .ansible-lint.local when running ansible-lint. Some rules might be disabled and some warnings might be ignored. See the notes in the configuration file.
shell> ansible-lint -c .ansible-lint.local
References
- FreeBSD handbook: Using the Ports Collection
- FreeBSD handbook: Building Packages with Poudriere
- portsnap
- portsnap.conf
- poudriere
License
Author Information
ansible-galaxy install vbotka.freebsd_ports