ansible-collections / ansible-consul

:satellite: Ansible role for Hashicorp Consul clusters
https://galaxy.ansible.com/ansible-community/consul/
BSD 2-Clause "Simplified" License
452 stars 313 forks source link

Fix gossip key generation failures, CI #547

Closed nre-ableton closed 1 year ago

nre-ableton commented 1 year ago

The primary purpose of this PR is to fix the gossip key generation issues, which this PR does by avoiding the race condition in Ansible when using copy with the content attribute when delegated to localhost.

Additionally, I "fixed" CI by suppressing risky-shell-pipe in ansible-lint. Unfortunately, adding set -o pipefail ahead of the shell commands isn't a great solution because the Molecule tests execute with /bin/sh, which unlike /bin/bash lacks support for set -o pipefail. The version of the shell that ships with the Docker container used by the Molecule tests also doesn't support set -o pipefail, so setting Molecule's executable won't work either.

FWIW, the reason that CI is currently broken is because even though we pinned the molecule-action GitHub action, it doesn't pin the Docker image correctly (see https://github.com/gofrolist/molecule-action/issues/140). An update to this image now forces us to fix new ansible-lint violations just to get CI back up and running.

Fixes https://github.com/ansible-community/ansible-consul/issues/506

bbaassssiiee commented 1 year ago

molecule.yml can embed ansible configuration to allow for a shell supporting pipefail (provided it's installed):

provisioner:
  name: ansible
  config_options:
    defaults:
      executable: /bin/bash
nre-ableton commented 1 year ago

molecule.yml can embed ansible configuration to allow for a shell supporting pipefail (provided it's installed):

provisioner:
  name: ansible
  config_options:
    defaults:
      executable: /bin/bash

Thanks for the advice, I didn't know about this configuration trick. I did some experimentation, but unfortunately I couldn't get it to work because the dokken Docker images ship a bash version that doesn't support set -o pipefile.

As such, I've updated the commit messages, comment in .ansible-lint, and PR description. Please have another look when you have a moment @bbaassssiiee, thanks!

nre-ableton commented 1 year ago

@bbaassssiiee Thanks for the review!