Archive for the ‘Ansible’ Category

Disable line-length Yamllint rule in Molecule

Just a quick post on how to disable the yamllint line-length rule in molecule tests (I’m always forgetting). ….roles/mongodb_repository/tasks/main.yml 8:81 error line too long (104 > 80 characters) (line-length) 10:81 error line too long (81 > 80 characters) (line-length) 27:81 error line too long (124 > 80 characters) (line-length) 34:81 error line too long (130 […]

Ignore PEP rules with Molecule / Testinfra / flake8

I’m always forgetting how to configure my molecule.yml file to ignore certain PEP8 rules. Here’s a quick example showing how to ignore the E501 Line too long rule: verifier: name: testinfra lint: name: flake8 options: ignore: ‘E501’

Using Ansible Modules with Testinfra

I’ve been looking at improving the quality of the testing I do with Molecule and Testinfra. Simple checks like service.is_running or package.is_installed have their place but they’re pretty limited as to what assurances they provide us. Part of the issue I have is that some tests need a fair bit of setup to make them […]

Wait for processes to end with Ansible

I’ve been doing a lot in stuff in ansible recently where I needed to fire up, kill and relaunch a bunch of processes. I wanted to find a quick and reliable way of managing this… This is possible using a combination of the pids and wait_for modules… First get the pids of your process… – […]

ansible-vault unexpected exception on Ubuntu

When attempting to edit an ansible-vault file… ansible-vault edit roles/cassandra_backup/vars/test_s3_cfg.yaml The following error was received… ERROR! Unexpected Exception, this is probably a bug: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object Encountered on this version of Ubuntu… Linux xxxxxxxxx 4.15.0-43-generic #46~16.04.1-Ubuntu SMP Fri Dec 7 13:31:08 […]