modules/: modules (or component modules)- Usually only support a single operating system.
modules/roles_profiles/manifests/profiles: profiles- Profiles provide an OS-independent interface to functionality provided by roles.
- Where os detection and routing is done.
modules/roles_profiles/manifests/roles- Roles specify everything a machine type needs to fufill a role.
- Calls a single profile, maps to device groups.
- #1 Profiles can't call other profiles.
- Goal is to have roles be completely transparent (at least at the top level).
- Exception: Allowed when creating 'base' OS profiles.
- #2 Profiles can't be called/included inside (component) modules.
- #3 Hiera lookups should only be done within profiles and then passed as args to the class.
More information:
- https://puppet.com/docs/puppet/6/designing_system_configs_roles_and_profiles.html
- https://puppet.com/docs/puppet/6/the_roles_and_profiles_method.html#the_roles_and_profiles_method
Many profiles run puppet at boot, but some only do on demand.
# setup bolt first, see https://mana.mozilla.org/wiki/display/ROPS/M1+and+R8+Catalina+Deployment
bolt plan run deploy::apply -t macmini-r8-140.test.releng.mdc1.mozilla.com noop=false -v
test-kitchen (with kitchen-puppet ) provides infrastructure to automate running Puppet convergence and InSpec tests for each role.
The repo contains configurations for Test Kitchen to use Vagant, Docker, and Mac instances.
test-kitchen in called via ./bin/kitchen_docker (the binary tells test-kitchen to use the .kitchen_configs/kitchen_docker.yml config file).
InSpec tests live in tests/integration/SUITE/inspec/*_spec.rb.
In the past we used ./bin/kitchen (which used Vagrant and VirtualBox, and was configured in .kitchen_configs/kitchen.yml). .kitchen_configs/kitchen.circleci.yml was used for CircleCI (but it now uses the Docker config).
We used Vagrant/VirtualBox because some things don't work with Docker (kernel module installation and testing).
The legacy Vagrant configuration targets x86 Ubuntu boxes and has not been validated on Apple Silicon. Restoring local VM testing on ARM Macs could use Kitchen/Vagrant with VMware Fusion and an ARM64 Ubuntu box, or Lima with additional integration.
# install rbenv and the repo-pinned Ruby
brew install rbenv ruby-build
rbenv install -s "$(cat .ruby-version)"
rbenv local "$(cat .ruby-version)"
gem install bundler
# install testing tools
bundle install
## testing bitbar workers
./bin/kitchen_docker converge bitbar
# run spec tests
./bin/kitchen_docker verify bitbar
## testing linux-perf workers
# coverge host
./bin/kitchen_docker converge linux-perf
# run serverspec tests
./bin/kitchen_docker verify linux-perf
# login to host
./bin/kitchen_docker login linux-perfDo not simulate interrupted dpkg by writing arbitrary files into
/var/lib/dpkg/updates; apt may detect that state, but
dpkg --configure -a will correctly reject invalid update files.
Use a real unpacked package state instead:
./bin/kitchen_docker exec linux-perf-ubuntu-2404 -c \
'sudo rm -f /var/lib/dpkg/updates/0001 && cd /tmp && apt-get download zstd && sudo dpkg --unpack ./zstd_*.deb && sudo dpkg --audit'Then run run-puppet and confirm dpkg --audit is clean afterward.
- Edit
.kitchen.docker.yml. Set the appropriate details. - (optional) Write spec tests.
- Convergence is somewhat tolerant of failures. Write tests to ensure that the system is in the desired state. Tests help ensure that refactoring doesn't break things also.
- See
tests/integration.
- Add the new suite to CircleCI.
- See
.circleci/config.yml.
The InSpec tests (see above) can be run on production hosts also.
inspec exec test/integration/linux/inspec/ -t ssh://t-linux64-ms-001.test.releng.mdc1.mozilla.com -i ~/.ssh/id_rsa --user=aerickson --sudoVagrant is useful for testing the full masterless bootstrapping process (test-kitchen handles this normally).
Vagrant mounts this directory at /vagrant.
gem install bundler
bundle install
vagrant up bionic-bare
vagrant ssh bionic-bare
sudo /vagrant/provisioners/linux/bootstrap_bitbar_devicepool.sh