notebook/IT/Ansible/Molecule.md
vincent a065caf8cc
All checks were successful
continuous-integration/drone/push Build is passing
correct uppercase
2022-10-09 17:11:12 +02:00

1.2 KiB

molecule

Molecule est un framework permettant de tester les roles ansible.

Il supporte diferent driver:

  • Docker (default)
  • Vagrant
  • Libvirtd

Hierarchie

Les fichiers de configuration sont instalé dans le role sous molecule/default

Les principaux fichier sont les suivants:

  • molecule.yml configuration central
  • converge.yml playbook contenant l'appel du role a tester
  • verify.yml playbook effectuant les tests

molecule.yml

ce ficheier de config poséde diferent clés principal:

  • dependency
  • driver
  • lint
  • platform
  • provisioner
  • scenario
  • verifier

Scenario

Scenario par defaut:

scenario:
  create_sequence:
    - dependency
    - create
    - prepare
  check_sequence:
    - dependency
    - cleanup
    - destroy
    - create
    - prepare
    - converge
    - check
    - destroy
  converge_sequence:
    - dependency
    - create
    - prepare
    - converge
  destroy_sequence:
    - dependency
    - cleanup
    - destroy
  test_sequence:
    - dependency
    - lint
    - cleanup
    - destroy
    - syntax
    - create
    - prepare
    - converge
    - idempotence
    - side_effect
    - verify
    - cleanup
    - destroy