Parcourir la source

Ansible changed_when fix; ansible/vagrant lint (#1734)

mmetc il y a 2 ans
Parent
commit
faf3670e7f
67 fichiers modifiés avec 339 ajouts et 240 suppressions
  1. 1 0
      tests/ansible/prepare_tests.yml
  2. 1 0
      tests/ansible/provision_dependencies.yml
  3. 1 0
      tests/ansible/provision_test_suite.yml
  4. 15 6
      tests/ansible/requirements.yml
  5. 1 0
      tests/ansible/roles/bats_requirements/defaults/main.yml
  6. 1 0
      tests/ansible/roles/bats_requirements/tasks/bash.yml
  7. 1 0
      tests/ansible/roles/bats_requirements/tasks/daemonize.yml
  8. 1 0
      tests/ansible/roles/bats_requirements/tasks/main.yml
  9. 1 0
      tests/ansible/roles/bats_requirements/tasks/netcat.yml
  10. 1 0
      tests/ansible/roles/common/tasks/main.yml
  11. 1 0
      tests/ansible/roles/install_crowdsec_package/tasks/install_from_deb.yml
  12. 1 0
      tests/ansible/roles/install_crowdsec_package/tasks/install_from_deb_repo.yml
  13. 1 0
      tests/ansible/roles/install_crowdsec_package/tasks/install_from_rpm.yml
  14. 3 2
      tests/ansible/roles/install_crowdsec_package/tasks/install_from_rpm_repo.yml
  15. 1 0
      tests/ansible/roles/install_crowdsec_package/tasks/main.yml
  16. 1 0
      tests/ansible/roles/install_crowdsec_package/vars/main.yml
  17. 1 0
      tests/ansible/roles/install_crowdsec_tests/defaults/main.yml
  18. 2 1
      tests/ansible/roles/install_crowdsec_tests/tasks/main.yml
  19. 1 0
      tests/ansible/roles/machine_id/defaults/main.yml
  20. 1 0
      tests/ansible/roles/machine_id/tasks/main.yml
  21. 2 1
      tests/ansible/roles/make_fixture/tasks/main.yml
  22. 1 0
      tests/ansible/roles/make_fixture/vars/main.yml
  23. 4 3
      tests/ansible/roles/run_func_tests/tasks/main.yml
  24. 1 0
      tests/ansible/roles/run_func_tests/vars/main.yml
  25. 1 0
      tests/ansible/run_all.yml
  26. 1 0
      tests/ansible/run_tests.yml
  27. 0 34
      tests/ansible/vagrant/Vagrantfile.common
  28. 6 4
      tests/ansible/vagrant/alma-8/Vagrantfile
  29. 6 4
      tests/ansible/vagrant/alma-9/Vagrantfile
  30. 6 4
      tests/ansible/vagrant/centos-7/Vagrantfile
  31. 6 4
      tests/ansible/vagrant/centos-8/Vagrantfile
  32. 6 4
      tests/ansible/vagrant/centos-9/Vagrantfile
  33. 41 0
      tests/ansible/vagrant/common
  34. 6 4
      tests/ansible/vagrant/debian-10-buster/Vagrantfile
  35. 6 4
      tests/ansible/vagrant/debian-11-bullseye/Vagrantfile
  36. 6 4
      tests/ansible/vagrant/debian-9-stretch/Vagrantfile
  37. 6 4
      tests/ansible/vagrant/debian-testing/Vagrantfile
  38. 10 8
      tests/ansible/vagrant/experimental/alpine-3.16/Vagrantfile
  39. 8 7
      tests/ansible/vagrant/experimental/amazon-linux-2/Vagrantfile
  40. 8 7
      tests/ansible/vagrant/experimental/arch/Vagrantfile
  41. 8 7
      tests/ansible/vagrant/experimental/devuan-3/Vagrantfile
  42. 8 7
      tests/ansible/vagrant/experimental/dragonflybsd-6/Vagrantfile
  43. 10 8
      tests/ansible/vagrant/experimental/gentoo/Vagrantfile
  44. 10 8
      tests/ansible/vagrant/experimental/hardenedbsd-13/Vagrantfile
  45. 10 8
      tests/ansible/vagrant/experimental/netbsd-9/Vagrantfile
  46. 10 8
      tests/ansible/vagrant/experimental/openbsd-7/Vagrantfile
  47. 10 8
      tests/ansible/vagrant/experimental/opensuse-15.4/Vagrantfile
  48. 10 8
      tests/ansible/vagrant/experimental/ubuntu-14.04-trusty/Vagrantfile
  49. 6 5
      tests/ansible/vagrant/fedora-33/Vagrantfile
  50. 6 5
      tests/ansible/vagrant/fedora-34/Vagrantfile
  51. 7 6
      tests/ansible/vagrant/fedora-35/Vagrantfile
  52. 6 5
      tests/ansible/vagrant/fedora-36/Vagrantfile
  53. 6 4
      tests/ansible/vagrant/freebsd-12/Vagrantfile
  54. 6 4
      tests/ansible/vagrant/freebsd-13/Vagrantfile
  55. 6 4
      tests/ansible/vagrant/oracle-7/Vagrantfile
  56. 6 4
      tests/ansible/vagrant/oracle-8/Vagrantfile
  57. 6 4
      tests/ansible/vagrant/oracle-9/Vagrantfile
  58. 6 4
      tests/ansible/vagrant/rocky-8/Vagrantfile
  59. 6 4
      tests/ansible/vagrant/rocky-9/Vagrantfile
  60. 6 5
      tests/ansible/vagrant/ubuntu-16.04-xenial/Vagrantfile
  61. 6 4
      tests/ansible/vagrant/ubuntu-18.04-bionic/Vagrantfile
  62. 6 5
      tests/ansible/vagrant/ubuntu-20.04-focal/Vagrantfile
  63. 6 5
      tests/ansible/vagrant/ubuntu-22.04-jammy/Vagrantfile
  64. 2 1
      tests/ansible/vars/go.yml
  65. 1 0
      tests/ansible/vars/mysql.yml
  66. 1 0
      tests/ansible/vars/postgres.yml
  67. 0 4
      tests/lib/setup_file.sh

+ 1 - 0
tests/ansible/prepare_tests.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "prepare functional tests"
   hosts: all

+ 1 - 0
tests/ansible/provision_dependencies.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "install Go (!bsd)"
   hosts: all

+ 1 - 0
tests/ansible/provision_test_suite.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "install the test scripts"
   hosts: all

+ 15 - 6
tests/ansible/requirements.yml

@@ -1,9 +1,18 @@
+# vim: set ft=yaml.ansible:
 ---
-- src: geerlingguy.mysql
-- src: geerlingguy.repo-epel
-- src: gantsign.golang
-- src: https://github.com/crowdsecurity/ansible-role-postgresql
-  version: crowdsec
-  name: geerlingguy.postgresql
+roles:
+  - src: geerlingguy.mysql
+  - src: geerlingguy.repo-epel
+  - src: gantsign.golang
+  - src: https://github.com/crowdsecurity/ansible-role-postgresql
+    version: crowdsec
+    name: geerlingguy.postgresql
 
+#collections:
+#  - name: crowdsecurity.testing
+#    source: ~/src/crowdsecurity.testing/crowdsecurity/testing
+#    type: dir
 
+#  - name: crowdsecurity.testing
+#    src: https://github.com/crowdsecurity/crowdsecurity.testing
+#    version: main

+ 1 - 0
tests/ansible/roles/bats_requirements/defaults/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 build_bash: false
 bash_version: 5.1.16

+ 1 - 0
tests/ansible/roles/bats_requirements/tasks/bash.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "check if we need to build bash"
   become: false

+ 1 - 0
tests/ansible/roles/bats_requirements/tasks/daemonize.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "install daemonize package"
   become: true

+ 1 - 0
tests/ansible/roles/bats_requirements/tasks/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "install bash"
   ansible.builtin.import_tasks: bash.yml

+ 1 - 0
tests/ansible/roles/bats_requirements/tasks/netcat.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "install netcat (Amazon, Fedora, CentOS, Oracle)"
   become: true

+ 1 - 0
tests/ansible/roles/common/tasks/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "update package cache (Debian)"
   become: true

+ 1 - 0
tests/ansible/roles/install_crowdsec_package/tasks/install_from_deb.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "set package_file from package_dir"
   ansible.builtin.set_fact:

+ 1 - 0
tests/ansible/roles/install_crowdsec_package/tasks/install_from_deb_repo.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "install stuff"
   become: true

+ 1 - 0
tests/ansible/roles/install_crowdsec_package/tasks/install_from_rpm.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "set package_file from package_dir"
   ansible.builtin.set_fact:

+ 3 - 2
tests/ansible/roles/install_crowdsec_package/tasks/install_from_rpm_repo.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "install crowdsec from the package repository"
   become: true
@@ -10,7 +11,7 @@
     - name: "stable rpm repo"
       ansible.builtin.command:
         cmd: "/root/rpm.sh"
-      changed_when: false
+      changed_when: true
 
     - name: "testing rpm repo script"
       ansible.builtin.get_url:
@@ -20,7 +21,7 @@
     - name: "testing rpm repo"
       ansible.builtin.command:
         cmd: "/root/rpm-testing.sh"
-      changed_when: false
+      changed_when: true
 
     - name: "install crowdsec"
       ansible.builtin.package:

+ 1 - 0
tests/ansible/roles/install_crowdsec_package/tasks/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "set releasever for RedHat family"
   ansible.builtin.set_fact:

+ 1 - 0
tests/ansible/roles/install_crowdsec_package/vars/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 
 package_version_deb: "{{ lookup('ansible.builtin.env', 'TEST_PACKAGE_VERSION_DEB') }}"

+ 1 - 0
tests/ansible/roles/install_crowdsec_tests/defaults/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 suite_git: "https://github.com/crowdsecurity/crowdsec"
 suite_version: "master"

+ 2 - 1
tests/ansible/roles/install_crowdsec_tests/tasks/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "lookup $TEST_SUITE_GIT"
   ansible.builtin.set_fact:
@@ -22,7 +23,7 @@
         name:
           - unzip
 
-    - name: "install tests: create crowdsec dir"
+    - name: "install tests: create source dir"
       become: false
       ansible.builtin.file:
         path: "{{ ansible_env.HOME }}/crowdsec"

+ 1 - 0
tests/ansible/roles/machine_id/defaults/main.yml

@@ -1,2 +1,3 @@
+# vim: set ft=yaml.ansible:
 ---
 machine_id: "githubciXXXXXXXXXXXXXXXXXXXXXXXX\n"

+ 1 - 0
tests/ansible/roles/machine_id/tasks/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "set /etc/machine-id"
   become: true

+ 2 - 1
tests/ansible/roles/make_fixture/tasks/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "set make_cmd = make (!bsd)"
   ansible.builtin.set_fact:
@@ -66,7 +67,7 @@
     - name: "look for .environment.sh"
       ansible.builtin.slurp:
         src: "{{ ansible_env.HOME }}/crowdsec/tests/.environment.sh"
-      changed_when: false
+      changed_when: true
       register: envfile
     - name: "cat .environment.sh"
       ansible.builtin.debug:

+ 1 - 0
tests/ansible/roles/make_fixture/vars/main.yml

@@ -1,2 +1,3 @@
+# vim: set ft=yaml.ansible:
 ---
 package_testing: "{{ lookup('ansible.builtin.env', 'PACKAGE_TESTING') }}"

+ 4 - 3
tests/ansible/roles/run_func_tests/tasks/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "tweak systemd configuration for tests"
   become: true
@@ -31,7 +32,7 @@
     - name: "look for .environment.sh"
       ansible.builtin.slurp:
         src: "{{ ansible_env.HOME }}/crowdsec/tests/.environment.sh"
-      changed_when: false
+      changed_when: true
       register: envfile
     - name: "cat .environment.sh"
       ansible.builtin.debug:
@@ -59,7 +60,7 @@
         # pidof -> /usr/sbin
         # bash -> /opt/bash/bin
         PATH: "/opt/bash/bin:{{ ansible_env.PATH }}:/usr/sbin:/usr/local/sbin"
-      changed_when: false
+      changed_when: true
       when:
         - (item.path | basename) not in skip_tests.split(',')
   rescue:
@@ -88,7 +89,7 @@
         # pidof -> /usr/sbin
         # bash -> /opt/bash/bin
         PATH: "/opt/bash/bin:{{ ansible_env.PATH }}:/usr/sbin:/usr/local/sbin"
-      changed_when: false
+      changed_when: true
       when:
         - (item.path | basename) not in skip_tests.split(',')
   rescue:

+ 1 - 0
tests/ansible/roles/run_func_tests/vars/main.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 package_testing: "{{ lookup('ansible.builtin.env', 'PACKAGE_TESTING') }}"
 skip_tests: "{{ lookup('ansible.builtin.env', 'TEST_SKIP') }}"

+ 1 - 0
tests/ansible/run_all.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - import_playbook: provision_dependencies.yml
 - import_playbook: provision_test_suite.yml

+ 1 - 0
tests/ansible/run_tests.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 - name: "run functional tests"
   hosts: all

+ 0 - 34
tests/ansible/vagrant/Vagrantfile.common

@@ -1,34 +0,0 @@
-Vagrant.configure("2") do |config|
-  config.vm.provider :libvirt do |libvirt|
-    libvirt.cpus = 1
-    libvirt.memory = 1536
-  end
-
-  config.vm.synced_folder '.', '/vagrant', disabled: true
-
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../ansible.cfg"
-    ansible.playbook = "../../run_all.yml"
-  end
-
-  # same as above, to run the steps separately
-
-  # config.vm.provision "ansible" do |provdep|
-  #   provdep.config_file = "../../ansible-common.cfg"
-  #   provdep.playbook = "../../provision_dependencies.yml"
-  # end
-  # config.vm.provision "ansible" do |provtest|
-  #   provtest.config_file = "../../ansible-common.cfg"
-  #   provtest.playbook = "../../provision_test_suite.yml"
-  # end
-  # config.vm.provision "ansible" do |preptest|
-  #   preptest.config_file = "../../ansible-common.cfg"
-  #   preptest.playbook = "../../prepare_tests.yml"
-  # end
-  # config.vm.provision "ansible" do |runtests|
-  #   runtests.config_file = "../../ansible-common.cfg"
-  #   runtests.playbook = "../../run_tests.yml"
-  # end
-
-end

+ 6 - 4
tests/ansible/vagrant/alma-8/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/alma8"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/alma8'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/alma-9/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/alma9"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/alma9'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/centos-7/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "centos/7"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'centos/7'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/centos-8/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "centos/stream8"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'centos/stream8'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/centos-9/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/centos9s"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/centos9s'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 41 - 0
tests/ansible/vagrant/common

@@ -0,0 +1,41 @@
+# vim: set ft=ruby:
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.define 'crowdsec'
+
+  config.vm.provider :libvirt do |libvirt|
+    libvirt.cpus = 1
+    libvirt.memory = 1536
+  end
+
+  config.vm.synced_folder '.', '/vagrant', disabled: true
+
+  config.vm.provision 'ansible' do |ansible|
+    # ansible.verbose = 'vvvv'
+    ansible.config_file = '../../ansible.cfg'
+    ansible.playbook = '../../run_all.yml'
+  end
+
+  # same as above, to run the steps separately
+
+  # config.vm.provision 'ansible' do |provdep|
+  #   provdep.config_file = '../../ansible-common.cfg'
+  #   provdep.playbook = '../../provision_dependencies.yml'
+  # end
+
+  # config.vm.provision 'ansible' do |provtest|
+  #   provtest.config_file = '../../ansible-common.cfg'
+  #   provtest.playbook = '../../provision_test_suite.yml'
+  # end
+
+  # config.vm.provision 'ansible' do |preptest|
+  #   preptest.config_file = '../../ansible-common.cfg'
+  #   preptest.playbook = '../../prepare_tests.yml'
+  # end
+
+  # config.vm.provision 'ansible' do |runtests|
+  #   runtests.config_file = '../../ansible-common.cfg'
+  #   runtests.playbook = '../../run_tests.yml'
+  # end
+end

+ 6 - 4
tests/ansible/vagrant/debian-10-buster/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "debian/buster64"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'debian/buster64'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/debian-11-bullseye/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "debian/bullseye64"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'debian/bullseye64'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/debian-9-stretch/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "debian/stretch64"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'debian/stretch64'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/debian-testing/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "debian/testing64"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'debian/testing64'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 10 - 8
tests/ansible/vagrant/experimental/alpine-3.16/Vagrantfile

@@ -1,6 +1,10 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/alpine316"
-  config.vm.provision "shell", path: "bootstrap"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/alpine316'
+  config.vm.define 'crowdsec'
+
+  config.vm.provision 'shell', path: 'bootstrap'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -9,10 +13,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 8 - 7
tests/ansible/vagrant/experimental/amazon-linux-2/Vagrantfile

@@ -1,5 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "cloudnatives/amazon-linux-2"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'cloudnatives/amazon-linux-2'
+  config.vm.define 'crowdsec'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -8,10 +11,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 8 - 7
tests/ansible/vagrant/experimental/arch/Vagrantfile

@@ -1,5 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/arch"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/arch'
+  config.vm.define 'crowdsec'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -8,10 +11,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 8 - 7
tests/ansible/vagrant/experimental/devuan-3/Vagrantfile

@@ -1,5 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/devuan3"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/devuan3'
+  config.vm.define 'crowdsec'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -8,10 +11,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 8 - 7
tests/ansible/vagrant/experimental/dragonflybsd-6/Vagrantfile

@@ -1,5 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/dragonflybsd6"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/dragonflybsd6'
+  config.vm.define 'crowdsec'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -8,10 +11,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 10 - 8
tests/ansible/vagrant/experimental/gentoo/Vagrantfile

@@ -1,6 +1,10 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/gentoo"
-  config.vm.provision "shell", path: "bootstrap"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/gentoo'
+  config.vm.define 'crowdsec'
+
+  config.vm.provision 'shell', path: 'bootstrap'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -9,10 +13,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 10 - 8
tests/ansible/vagrant/experimental/hardenedbsd-13/Vagrantfile

@@ -1,6 +1,10 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/hardenedbsd13"
-  config.vm.provision "shell", path: "bootstrap"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/hardenedbsd13'
+  config.vm.define 'crowdsec'
+
+  config.vm.provision 'shell', path: 'bootstrap'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -9,10 +13,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 10 - 8
tests/ansible/vagrant/experimental/netbsd-9/Vagrantfile

@@ -1,6 +1,10 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/netbsd9"
-  # config.vm.provision "shell", path: "bootstrap"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/netbsd9'
+  config.vm.define 'crowdsec'
+
+  # config.vm.provision 'shell', path: 'bootstrap'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -9,10 +13,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 10 - 8
tests/ansible/vagrant/experimental/openbsd-7/Vagrantfile

@@ -1,6 +1,10 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/openbsd7"
-  config.vm.provision "shell", path: "bootstrap"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/openbsd7'
+  config.vm.define 'crowdsec'
+
+  config.vm.provision 'shell', path: 'bootstrap'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -9,10 +13,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 10 - 8
tests/ansible/vagrant/experimental/opensuse-15.4/Vagrantfile

@@ -1,6 +1,10 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "opensuse/Leap-15.4.x86_64"
-  config.vm.provision "shell", path: "bootstrap"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'opensuse/Leap-15.4.x86_64'
+  config.vm.define 'crowdsec'
+
+  config.vm.provision 'shell', path: 'bootstrap'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -9,10 +13,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 10 - 8
tests/ansible/vagrant/experimental/ubuntu-14.04-trusty/Vagrantfile

@@ -1,6 +1,10 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "peru/ubuntu-14.04-server-amd64"
-  config.vm.box_version = "20190901.01"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'peru/ubuntu-14.04-server-amd64'
+  config.vm.define 'crowdsec'
+
+  config.vm.box_version = '20190901.01'
 
   config.vm.provider :libvirt do |libvirt|
     libvirt.cpus = 1
@@ -9,10 +13,8 @@ Vagrant.configure("2") do |config|
 
   config.vm.synced_folder '.', '/vagrant', disabled: true
 
-  config.vm.provision "ansible" do |ansible|
-    # ansible.verbose = "vvvv"
-    ansible.config_file = "../../../ansible.cfg"
-    ansible.playbook = "../../../run_all.yml"
+  config.vm.provision 'ansible' do |ansible|
+    ansible.config_file = '../../../ansible.cfg'
+    ansible.playbook = '../../../run_all.yml'
   end
-
 end

+ 6 - 5
tests/ansible/vagrant/fedora-33/Vagrantfile

@@ -1,8 +1,9 @@
-Vagrant.configure("2") do |config|
-  # the official boxes seem to have issues with journalctl
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
   # config.vm.box = "fedora/33-cloud-base"
-  config.vm.box = "generic/fedora33"
+  config.vm.box = 'generic/fedora33'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 5
tests/ansible/vagrant/fedora-34/Vagrantfile

@@ -1,8 +1,9 @@
-Vagrant.configure("2") do |config|
-  # the official boxes seem to have issues with journalctl
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
   # config.vm.box = "fedora/34-cloud-base"
-  config.vm.box = "generic/fedora34"
+  config.vm.box = 'generic/fedora34'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 7 - 6
tests/ansible/vagrant/fedora-35/Vagrantfile

@@ -1,8 +1,9 @@
-Vagrant.configure("2") do |config|
-  # the official boxes seem to have issues with journalctl
-  # config.vm.box = "fedora/35-cloud-base"
-  config.vm.box = "generic/fedora35"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  # config.vm.box = 'fedora/35-cloud-base'
+  config.vm.box = 'generic/fedora35'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 5
tests/ansible/vagrant/fedora-36/Vagrantfile

@@ -1,8 +1,9 @@
-Vagrant.configure("2") do |config|
-  # the official boxes seem to have issues with journalctl
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
   # config.vm.box = "fedora/36-cloud-base"
-  config.vm.box = "generic/fedora36"
+  config.vm.box = 'generic/fedora36'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/freebsd-12/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/freebsd12"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/freebsd12'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/freebsd-13/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/freebsd13"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/freebsd13'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/oracle-7/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/oracle7"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/oracle7'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/oracle-8/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/oracle8"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/oracle8'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/oracle-9/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/oracle9"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/oracle9'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/rocky-8/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/rocky8"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/rocky8'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/rocky-9/Vagrantfile

@@ -1,6 +1,8 @@
-Vagrant.configure("2") do |config|
-  config.vm.box = "generic/rocky9"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/rocky9'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 5
tests/ansible/vagrant/ubuntu-16.04-xenial/Vagrantfile

@@ -1,7 +1,8 @@
-Vagrant.configure("2") do |config|
-  # the official boxes only supports virtualbox
-  config.vm.box = "generic/ubuntu1604"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/ubuntu1604'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 4
tests/ansible/vagrant/ubuntu-18.04-bionic/Vagrantfile

@@ -1,7 +1,9 @@
-Vagrant.configure("2") do |config|
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
   # the official boxes only supports virtualbox
-  config.vm.box = "generic/ubuntu1804"
+  config.vm.box = 'generic/ubuntu1804'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 5
tests/ansible/vagrant/ubuntu-20.04-focal/Vagrantfile

@@ -1,7 +1,8 @@
-Vagrant.configure("2") do |config|
-  # the official boxes only supports virtualbox
-  config.vm.box = "generic/ubuntu2004"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/ubuntu2004'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 6 - 5
tests/ansible/vagrant/ubuntu-22.04-jammy/Vagrantfile

@@ -1,7 +1,8 @@
-Vagrant.configure("2") do |config|
-  # the official boxes only supports virtualbox
-  config.vm.box = "generic/ubuntu2204"
+# frozen_string_literal: true
+
+Vagrant.configure('2') do |config|
+  config.vm.box = 'generic/ubuntu2204'
 end
 
-common = '../Vagrantfile.common'
-load common if File.exists?(common)
+common = '../common'
+load common if File.exist?(common)

+ 2 - 1
tests/ansible/vars/go.yml

@@ -1,2 +1,3 @@
-golang_version: "1.18.2"
+# vim: set ft=yaml.ansible:
+golang_version: "1.18.5"
 golang_install_dir: "/opt/go/{{ golang_version }}"

+ 1 - 0
tests/ansible/vars/mysql.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 
 # The password is insecure since the db is ephemeral and only listen to localhost.

+ 1 - 0
tests/ansible/vars/postgres.yml

@@ -1,3 +1,4 @@
+# vim: set ft=yaml.ansible:
 ---
 
 # The password is insecure since the db is ephemeral and only listen to localhost.

+ 0 - 4
tests/lib/setup_file.sh

@@ -4,10 +4,6 @@
 # https://github.com/bats-core/bats-core/blob/master/docs/source/warnings/BW02.rst
 bats_require_minimum_version 1.5.0
 
-# this should have effect globally, for all tests
-# https://github.com/bats-core/bats-core/blob/master/docs/source/warnings/BW02.rst
-bats_require_minimum_version 1.5.0
-
 debug() {
     echo 'exec 1<&-; exec 2<&-; exec 1>&3; exec 2>&1'
 }