From 22f4c03891bf4397f762571c5dd264c336d56496 Mon Sep 17 00:00:00 2001
From: fejao <mail@fejao.de>
Date: Sun, 2 Feb 2025 19:47:42 +0000
Subject: [PATCH] Setting molecule 05

---
 README.md                                     |   6 +-
 roles/clone_repositories/README.md            |   2 +-
 .../molecule/default/converge.yml             |   8 +-
 .../molecule/default/verify.yml               |   8 +-
 roles/dependencies/README.md                  |   2 +-
 .../molecule/default/converge.yml             |   8 +-
 .../dependencies/molecule/default/verify.yml  |   8 +-
 roles/docker_containers/README.md             |  67 ++++-
 roles/docker_containers/molecule/README.md    |  42 +++
 .../molecule/default/cleanup.yml              |  77 ++++++
 .../molecule/default/converge.yml             |  60 +++++
 .../molecule/default/molecule.yml             |  68 +++++
 .../molecule/default/verify.yml               | 248 ++++++++++++++++++
 .../tasks/printer_compose_up.yml              |   1 -
 .../tasks/printer_host_cups_disable.yml       |   7 -
 roles/docker_images/README.md                 |   2 +-
 .../molecule/default/converge.yml             |  10 +-
 .../docker_images/molecule/default/verify.yml |  10 +-
 18 files changed, 587 insertions(+), 47 deletions(-)
 create mode 100644 roles/docker_containers/molecule/README.md
 create mode 100644 roles/docker_containers/molecule/default/cleanup.yml
 create mode 100644 roles/docker_containers/molecule/default/converge.yml
 create mode 100644 roles/docker_containers/molecule/default/molecule.yml
 create mode 100644 roles/docker_containers/molecule/default/verify.yml

diff --git a/README.md b/README.md
index 75a2692..a01c9d3 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,9 @@
     - [x] docker_containers
 - [x] Set ansible-lint for the roles.
 - [ ] Add molecule tests.
-    - [x] dependencies
-    - [ ] clone_repositories
-    - [ ] docker_images
+    - [x] [dependencies](https://git.cccv.de/fejao/c3infodesk-deployment/-/commit/c04809f7f0644f2cdb1e8affb02ed6c4b623252a)
+    - [x] [clone_repositories](https://git.cccv.de/fejao/c3infodesk-deployment/-/commit/0b9aee5d2d9768b5f77494300e88857b9a3aceee)
+    - [x] [docker_images](https://git.cccv.de/fejao/c3infodesk-deployment/-/commit/a4d532169beed8a18bed536bb1e9a346b6a7b5c0)
     - [ ] docker_containers
 
 
diff --git a/roles/clone_repositories/README.md b/roles/clone_repositories/README.md
index 023fdf5..38b58af 100644
--- a/roles/clone_repositories/README.md
+++ b/roles/clone_repositories/README.md
@@ -1,4 +1,4 @@
-# clone-repositories
+# clone-repositories role
 
 This ansible-role for dealing with cloning the repositories necessary for deploying the system used from **c3infodesk**.
 
diff --git a/roles/clone_repositories/molecule/default/converge.yml b/roles/clone_repositories/molecule/default/converge.yml
index 1a55dbd..00147c2 100644
--- a/roles/clone_repositories/molecule/default/converge.yml
+++ b/roles/clone_repositories/molecule/default/converge.yml
@@ -3,27 +3,27 @@
 - name: MOLECULE | Converge
   hosts: all
   pre_tasks:
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../defaults
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../defaults
       ansible.builtin.include_vars:
         dir: ../../defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../roles/dependencies/defaults
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/dependencies/defaults
       ansible.builtin.include_vars:
         dir: ../../../../roles/dependencies/defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../../../inventories/group_vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/group_vars
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../../../inventories/host_vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/host_vars
         extensions:
diff --git a/roles/clone_repositories/molecule/default/verify.yml b/roles/clone_repositories/molecule/default/verify.yml
index 709795f..96e66b7 100644
--- a/roles/clone_repositories/molecule/default/verify.yml
+++ b/roles/clone_repositories/molecule/default/verify.yml
@@ -9,27 +9,27 @@
     package_name_docker_compose_plugin: 'docker-compose-plugin'
 
   pre_tasks:
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../defaults
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../defaults
       ansible.builtin.include_vars:
         dir: ../../defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../roles/dependencies/defaults
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/dependencies/defaults
       ansible.builtin.include_vars:
         dir: ../../../../roles/dependencies/defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../inventories/group_vars
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/group_vars
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../inventories/host_vars
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/host_vars
         extensions:
diff --git a/roles/dependencies/README.md b/roles/dependencies/README.md
index 9407b61..2405938 100644
--- a/roles/dependencies/README.md
+++ b/roles/dependencies/README.md
@@ -1,4 +1,4 @@
-# dependencies (role)
+# dependencies role
 
 
 This ansible-role for dealing with installing the dependencies for deploying the system used from **c3infodesk**.
diff --git a/roles/dependencies/molecule/default/converge.yml b/roles/dependencies/molecule/default/converge.yml
index 22530a7..ac4c198 100644
--- a/roles/dependencies/molecule/default/converge.yml
+++ b/roles/dependencies/molecule/default/converge.yml
@@ -3,27 +3,27 @@
 - name: MOLECULE | Converge
   hosts: all
   pre_tasks:
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../defaults
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../defaults
       ansible.builtin.include_vars:
         dir: ../../defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../vars
       ansible.builtin.include_vars:
         dir: ../../vars
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../../../inventories/group_vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/group_vars
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../../../inventories/host_vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/host_vars
         extensions:
diff --git a/roles/dependencies/molecule/default/verify.yml b/roles/dependencies/molecule/default/verify.yml
index 1f6bab3..0e486c2 100644
--- a/roles/dependencies/molecule/default/verify.yml
+++ b/roles/dependencies/molecule/default/verify.yml
@@ -9,27 +9,27 @@
     package_name_docker_compose_plugin: 'docker-compose-plugin'
 
   pre_tasks:
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../defaults
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../defaults
       ansible.builtin.include_vars:
         dir: ../../defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../vars
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../vars
       ansible.builtin.include_vars:
         dir: ../../vars
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../inventories/group_vars
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/group_vars
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../inventories/host_vars
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/host_vars
         extensions:
diff --git a/roles/docker_containers/README.md b/roles/docker_containers/README.md
index 416d0db..f4f2f2a 100644
--- a/roles/docker_containers/README.md
+++ b/roles/docker_containers/README.md
@@ -4,14 +4,38 @@ This is a ansible-role for dealing with the containers from **c3infodesk**.
 
 ## Requirements
 - To have [ansible](https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html) installed at your system.
-- Set your **remote_user** configuration at the **ansible.cfg** file.
-- Set your **inventories/host_vars/<TARGET_NAME>** file.
+
+
+## Configuration
+You need to set some configuration for this to work
+- ### ansible.cfg
+  You have to edit the **ansible.cfg** file to your needs for accessing your target.
+  - #### remote_user
+    You need to set the **remote_user** configuration for accessing the target host.
+
+    Example: [remote_user](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/ansible.cfg#L227)
+
+- ### HOST_VARS
+  In order to access your target host, you need to create/edit your **inventories/host_vars/<YOUR_HOST_NAME>.yml**
+  - #### ansible_become_pass
+    You need to set the **sudo** password from the user setted on **remote_user** for installing packages and etc. at the target.
+
+    Example: [ansible_become_pass](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/inventories/host_vars/example_server.yml#L5)
+
+- ### HOSTS
+  You need to provide a group in which your target belongs to with the same name setted for **inventories/host_vars/<YOUR_HOST_NAME>.yml**.
+
+  There you can add/edit the target address/IP.
+
+  Example: [hosts](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/inventories/hosts)
+
 
 ## Role Variables
-Here are the variables setted:
+Here are the variables to setted from this role:
 
 - ### From: inventories/host_vars/<TARGET_NAME>
   Here are the variables that you should be changing for your own deployment.
+
   - #### CUPS
     Here you can set the variables if you want to **disable** and/or **mask** the CUPS service at the target.
     - **c3infodesk_printer_host_cups_disable**: DEFAULT=<NOT_SETTED>
@@ -75,10 +99,11 @@ The role dependencies are:
   The **docker-compose.yml** file can be founded at the location setted from the **c3infodesk_printer_folder** path variable. The default is: **"~/Coding/c3infodesk-printer"** folder
 
 - ### Using the provided example
-  For using the playbook **playbooks/examples/playbook_example_05_docker_containers.yml** file you only need to:
-  - Change the user at the **ansible.cfg** file at the field **remote_user** for acessing your target.
-  - Update the file **inventories/host_vars/example_server.yml** and change the value for **ansible_become_pass** from the **remote_user**.
-  - Update the **inventories/hosts** file and change the **example_server** with the IP address from your target.
+    For using the example playbook **[playbooks/examples/example_02_dependencies.yml](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/playbooks/examples/example_02_dependencies.yml)** file you only need to:
+    - Change the user at the **[ansible.cfg](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/ansible.cfg)** file at the field **[remote_user](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/ansible.cfg#L227)** for acessing your target.
+    - Update the file **[inventories/host_vars/example_server.yml](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/inventories/host_vars/example_server.yml)** and change the value for **[ansible_become_pass](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/inventories/host_vars/example_server.yml#L5)** from the **[remote_user](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/ansible.cfg#L227)**
+    - Update the **[inventories/hosts](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/inventories/hosts)** file and change the **[example_server](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/inventories/hosts#L2)** with the IP address from your target.
+
 
   And run the command:
   ```bash
@@ -149,6 +174,34 @@ The role dependencies are:
     ```
 
 
+## Testing
+You can test this locally using **DIND (docker in docker)** at your own computer using [ansible molecule](https://ansible.readthedocs.io/projects/molecule/installation/)
+
+- ### Testing requirements
+  You need docker installed at your system and the [ansible molecule](https://ansible.readthedocs.io/projects/molecule/installation/).
+
+  You might have to set DIND at your system, for linux, you can create the file **/etc/docker/daemon.json**
+
+  And add the content and restart docker.
+
+  ```json
+  {
+    "exec-opts": ["native.cgroupdriver=systemd"],
+    "features": {
+      "buildkit": true
+    },
+    "experimental": true,
+    "cgroup-parent": "docker.slice"
+  }
+  ```
+
+- ### Using molecule
+  Just go to the root of the role **roles/dependencies** and run the command:
+
+  ```bash
+  molecule test
+  ```
+
 
 ## License
 
diff --git a/roles/docker_containers/molecule/README.md b/roles/docker_containers/molecule/README.md
new file mode 100644
index 0000000..4e02fc3
--- /dev/null
+++ b/roles/docker_containers/molecule/README.md
@@ -0,0 +1,42 @@
+## ansible molecule tests for role: docker_containers
+
+
+
+## Why to use it
+It's allways a good idea to test your things.
+
+With **ansible molecule** you can test your role locally without the need of using a **real server** but a local **docker container**.
+
+## Dependencies
+
+- ### molecule
+  You need to have [ansible molecule](https://ansible.readthedocs.io/projects/molecule/installation/) installed.
+
+- ### DIND (docker in docker)
+    For using the tests, you will to have **docker** installed locally and and set it for using **DIND (docker in docker)**
+
+
+    - ### DIND linux
+      You have to create/edit the file **/etc/docker/daemon.json** with the content:
+
+    ```json
+    {
+    "exec-opts": ["native.cgroupdriver=systemd"],
+    "features": {
+        "buildkit": true
+    },
+    "experimental": true,
+    "cgroup-parent": "docker.slice"
+    }
+    ```
+
+
+## Configuration
+There's not much for configuring for using the tests
+
+## Running the tests
+For running the **molecule tests** you just need to run the command:
+
+```bash
+molecule test
+```
diff --git a/roles/docker_containers/molecule/default/cleanup.yml b/roles/docker_containers/molecule/default/cleanup.yml
new file mode 100644
index 0000000..a0c59f7
--- /dev/null
+++ b/roles/docker_containers/molecule/default/cleanup.yml
@@ -0,0 +1,77 @@
+---
+
+- name: MOLECULE | Cleanup
+  hosts: all
+  vars:
+    package_name_docker: 'docker'
+    package_name_docker_ce: 'docker-ce'
+    package_name_docker_compose: 'docker-compose'
+    package_name_docker_compose_plugin: 'docker-compose-plugin'
+    container_name_cups: 'c3printing-cups'
+    container_name_app: 'c3printing-app'
+    container_name_proxy: 'c3printing-proxy'
+    container_name_influxdb: 'c3printing-influxdb'
+
+  pre_tasks:
+    ###
+    ### VARIABLES
+    ###
+    - name: MOLECULE | CLEANUP | PRE-TASKS | VARIABLES | From -> ../../defaults
+      ansible.builtin.include_vars:
+        dir: ../../defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | CLEANUP | PRE-TASKS | VARIABLES | From -> ../../../../roles/dependencies/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/dependencies/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | CLEANUP | PRE-TASKS | VARIABLES | From -> ../../../../roles/clone_repositories/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/clone_repositories/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | CLEANUP | PRE-TASKS | VARIABLES | From -> ../../../../roles/docker_images/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/docker_images/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | CLEANUP | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
+      ansible.builtin.include_vars:
+        dir: ../../../../inventories/group_vars
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | CLEANUP | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
+      ansible.builtin.include_vars:
+        dir: ../../../../inventories/host_vars
+        extensions:
+          - 'yml'
+
+    ###
+    ### DOCKER COMPOSE
+    ###
+    - name: MOLECULE | CLEANUP | PRE-TASKS | DOCKER | Remove all running containers.
+      community.docker.docker_compose_v2:
+        project_src: "{{ c3infodesk_printer_folder_docker }}"
+        # state: absent
+        state: absent
+      register: ret_docker_compose_down
+
+    - name: MOLECULE | CLEANUP | PRE-TASKS | DOCKER | Output from removing all containers.
+      ansible.builtin.debug:
+        var: ret_docker_compose_down
+      when: c3infodesk_printer_docker_compose_up_debug | bool
+
+    # - name: MOLECULE | CLEANUP | PRE-TASKS | DOCKER | raise error.
+    #   ansible.builtin.debug:
+    #     msg: "ERROR RAISED"
+    #   failed_when: true
diff --git a/roles/docker_containers/molecule/default/converge.yml b/roles/docker_containers/molecule/default/converge.yml
new file mode 100644
index 0000000..e879983
--- /dev/null
+++ b/roles/docker_containers/molecule/default/converge.yml
@@ -0,0 +1,60 @@
+---
+
+- name: MOLECULE | Converge
+  hosts: all
+  pre_tasks:
+    ###
+    ### VARIABLES
+    ###
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../defaults
+      ansible.builtin.include_vars:
+        dir: ../../defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | CONVERGE | PRE-TASKS | VARIABLES | From -> ../../../../roles/dependencies/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/dependencies/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | CONVERGE | PRE-TASKS | VARIABLES | From -> ../../../../roles/clone_repositories/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/clone_repositories/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | CONVERGE | PRE-TASKS | VARIABLES | From -> ../../../../roles/docker_images/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/docker_images/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
+      ansible.builtin.include_vars:
+        dir: ../../../../inventories/group_vars
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
+      ansible.builtin.include_vars:
+        dir: ../../../../inventories/host_vars
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | COVERGE | PRE-TASKS | Install python 'requests' package
+      ansible.builtin.pip:
+        name: requests
+
+  tasks:
+    - name: MOLECULE | CONVERGE | Call the 'clone_repositories' role for starting the containers.
+      vars:
+        c3infodesk_printer_host_cups_disable: true
+        c3infodesk_printer_host_cups_mask: true
+        c3infodesk_printer_docker_compose_up: true
+      ansible.builtin.include_role:
+        name: docker_containers
diff --git a/roles/docker_containers/molecule/default/molecule.yml b/roles/docker_containers/molecule/default/molecule.yml
new file mode 100644
index 0000000..9f0ed16
--- /dev/null
+++ b/roles/docker_containers/molecule/default/molecule.yml
@@ -0,0 +1,68 @@
+---
+
+dependency:
+  name: galaxy
+
+driver:
+  name: docker
+
+platforms:
+  - name: molecule_docker_containers
+    ### At the moment I'm not running at the latest kernel, please use always with a older kernel than the host
+    # image: docker.io/geerlingguy/docker-ubuntu2204-ansible
+    image: geerlingguy/docker-ubuntu2204-ansible:latest
+    command: /usr/sbin/init
+    pre_build_image: true
+    cgroupns_mode: host
+    privileged: true
+    volumes:
+      - /sys/fs/cgroup:/sys/fs/cgroup:rw
+      - /var/lib/containerd
+
+provisioner:
+  name: ansible
+
+lint: |
+  ansible-lint --exclude molecule/default/
+
+scenario:
+  name: default
+  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:
+    # - lint
+    # - dependency
+    # - cleanup
+    - destroy
+    - syntax
+    - create
+    # - prepare
+    - converge
+    - verify
+    - idempotence
+    # - side_effect
+    - cleanup
+    - destroy
+
+verifier:
+  name: ansible
diff --git a/roles/docker_containers/molecule/default/verify.yml b/roles/docker_containers/molecule/default/verify.yml
new file mode 100644
index 0000000..e10ed4d
--- /dev/null
+++ b/roles/docker_containers/molecule/default/verify.yml
@@ -0,0 +1,248 @@
+---
+
+- name: MOLECULE | Verify
+  hosts: all
+  vars:
+    package_name_docker: 'docker'
+    package_name_docker_ce: 'docker-ce'
+    package_name_docker_compose: 'docker-compose'
+    package_name_docker_compose_plugin: 'docker-compose-plugin'
+    container_name_cups: 'c3printing-cups'
+    container_name_app: 'c3printing-app'
+    container_name_proxy: 'c3printing-proxy'
+    # container_name_influxdb: 'c3printing-influxdb'
+
+  pre_tasks:
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../defaults
+      ansible.builtin.include_vars:
+        dir: ../../defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/dependencies/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/dependencies/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/clone_repositories/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/clone_repositories/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/docker_images/defaults
+      ansible.builtin.include_vars:
+        dir: ../../../../roles/docker_images/defaults
+        depth: 1
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
+      ansible.builtin.include_vars:
+        dir: ../../../../inventories/group_vars
+        extensions:
+          - 'yml'
+
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
+      ansible.builtin.include_vars:
+        dir: ../../../../inventories/host_vars
+        extensions:
+          - 'yml'
+
+  tasks:
+    ###
+    ### POPULATE
+    ###
+    - name: MOLECULE | VERIFY | POPULATE | Gather the package facts
+      ansible.builtin.package_facts:
+        manager: auto
+
+    - name: MOLECULE | VERIFY | POPULATE | Gather service facts
+      ansible.builtin.service_facts:
+
+    ###
+    ### TESTS - PACKAGES
+    ###
+    - name: MOLECULE | VERIFY | TEST | Check that the packages from 'os_dependencies_packages' are installed.
+      ansible.builtin.debug:
+        msg: "Package: '{{ package_name }}' is installed"
+      loop: "{{ os_dependencies_packages }}"
+      loop_control:
+        loop_var: package_name
+      failed_when: package_name not in ansible_facts.packages
+
+    - name: MOLECULE | VERIFY | TEST | Check that docker is installed.
+      ansible.builtin.debug:
+        msg: "Package: 'docker' is installed"
+      failed_when:
+        - package_name_docker not in ansible_facts.packages
+        - package_name_docker_ce not in ansible_facts.packages
+
+    - name: MOLECULE | VERIFY | TEST | Check that docker-compose is installed.
+      ansible.builtin.debug:
+        msg: "Package: 'docker-cokmpose' is installed"
+      failed_when:
+       - package_name_docker_compose not in ansible_facts.packages
+       - package_name_docker_compose_plugin not in ansible_facts.packages
+
+    ###
+    ### TESTS - DOCKER
+    ###
+    - name: MOLECULE | VERIFY | TEST | Get docker service state.
+      ansible.builtin.systemd:
+        name: "docker"
+      register: docker_service
+
+    - name: MOLECULE | VERIFY | TEST | Check that docker is running.
+      ansible.builtin.debug:
+        msg: "Docker IS running..."
+      failed_when: "'active' != docker_service.status.ActiveState"
+
+    ###
+    ### TESTS - ADDED USERS
+    ###
+    - name: MOLECULE | VERIFY | TEST | Get added users infos.
+      ansible.builtin.user:
+        name: "{{ item }}"
+      loop: "{{ docker_users }}"
+      check_mode: true
+      register: test_users
+
+    - name: MOLECULE | VERIFY | TEST | Check if users exists
+      ansible.builtin.debug:
+        msg: "User {{ item.item }} {{ 'exists' if item.state | d('') == 'present' else 'does not exist' }}"
+      loop: "{{ test_users.results }}"
+      loop_control:
+        label: "{{ item.item }}"
+
+    - name: MOLECULE | VERIFY | TEST | Get the groups that the users belongs to.
+      ansible.builtin.command:
+        cmd: "id -Gn {{ item.item }}"
+      loop: "{{ test_users.results }}"
+      loop_control:
+        label: "{{ item.item }}"
+      register: user_groups
+      changed_when: false
+
+    - name: MOLECULE | VERIFY | TEST | Check that the users are at the 'docker' group.
+      ansible.builtin.debug:
+        msg: "User '{{ item.item.item }}' belongs to the docker group"
+      with_items: "{{ user_groups.results }}"
+      failed_when: "'docker' not in item.stdout"
+
+    ###
+    ### TESTS - CLONE REPOSITORY - PRINTER
+    ###
+    - name: MOLECULE | VERIFY | TEST | Get if the repository was cloned.
+      ansible.builtin.git:
+        repo: "{{ c3infodesk_printer_repo_url }}"
+        dest: "{{ c3infodesk_printer_folder }}"
+        version: main
+        clone: false
+        update: false
+      register: check_repository
+
+    - name: MOLECULE | VERIFY | TEST | Checking if the repository was cloned.
+      ansible.builtin.debug:
+        msg: "Repository: '{{ c3infodesk_printer_repo_url }}' cloned..."
+      failed_when: check_repository.changed | bool
+
+    ###
+    ### TESTS - DOCKER IMAGES
+    ###
+    - name: MOLECULE | VERIFY | TEST | Get if the image is created for 'cups'.
+      community.docker.docker_image_info:
+        name: "{{ c3infodesk_printer_docker_img_cups_name }}"
+      register: result_check_image_cups
+
+    - name: MOLECULE | VERIFY | TEST | Check the image creation from 'cups'.
+      ansible.builtin.debug:
+        msg: "Image for 'cups' exists"
+      when: result_check_image_cups.images | length > 0
+
+    - name: MOLECULE | VERIFY | TEST | Get if the image is created for 'app'.
+      community.docker.docker_image_info:
+        name: "{{ c3infodesk_printer_docker_img_app_name }}"
+      register: result_check_image_app
+
+    - name: MOLECULE | VERIFY | TEST | Check the image creation from 'app'.
+      ansible.builtin.debug:
+        msg: "Image for 'app' exists"
+      when: result_check_image_app.images | length > 0
+
+    - name: MOLECULE | VERIFY | TEST | Get if the image is created for 'proxy'.
+      community.docker.docker_image_info:
+        name: "{{ c3infodesk_printer_docker_img_proxy_name }}"
+      register: result_check_image_proxy
+
+    - name: MOLECULE | VERIFY | TEST | Check the image creation from 'proxy'.
+      ansible.builtin.debug:
+        msg: "Image for 'proxy' exists"
+      when: result_check_image_proxy.images | length > 0
+
+    ###
+    ### TESTS - DOCKER CONTAINERS - CUPS DISABLE
+    ###
+
+    - name: MOLECULE | VERIFY | TEST | Get that the CUPS service is disable.
+      ansible.builtin.debug:
+        msg: "The service: 'cups.service' is not setted"
+      failed_when: "'cups.service' in ansible_facts.services"
+
+    ###
+    ### TESTS - DOCKER CONTAINERS - CUPS
+    ###
+    - name: MOLECULE | VERIFY | TEST | CONTAINER CUPS | Get infos on the container.
+      community.docker.docker_container_info:
+        name: "{{ container_name_cups }}"
+      register: ret_container_cups
+
+    - name: MOLECULE | VERIFY | TEST | CONTAINER CUPS | Check that the container exists.
+      ansible.builtin.debug:
+        msg: "The container '{{ container_name_cups }}' {{ 'exists' if ret_container_cups.exists else 'does not exist' }}"
+      failed_when: ret_container_cups.exists | bool is not true
+
+    - name: MOLECULE | VERIFY | TEST | CONTAINER CUPS | Check that the container is running.
+      ansible.builtin.debug:
+        msg: "The container '{{ container_name_cups }}' is running"
+      failed_when: ret_container_cups.container.State.Status != 'running'
+
+    ###
+    ### TESTS - DOCKER CONTAINERS - APP
+    ###
+    - name: MOLECULE | VERIFY | TEST | CONTAINER APP | Get infos on the container.
+      community.docker.docker_container_info:
+        name: "{{ container_name_app }}"
+      register: ret_container_app
+
+    - name: MOLECULE | VERIFY | TEST | CONTAINER APP | Check that the container exists.
+      ansible.builtin.debug:
+        msg: "The container '{{ container_name_app }}' {{ 'exists' if ret_container_app.exists else 'does not exist' }}"
+      failed_when: ret_container_app.exists | bool is not true
+
+    - name: MOLECULE | VERIFY | TEST | CONTAINER APP | Check that the container is running.
+      ansible.builtin.debug:
+        msg: "The container '{{ container_name_app }}' is running"
+      failed_when: ret_container_app.container.State.Status != 'running'
+
+    ###
+    ### TESTS - DOCKER CONTAINERS - PROXY
+    ###
+    - name: MOLECULE | VERIFY | TEST | CONTAINER PROXY | Get infos on the container.
+      community.docker.docker_container_info:
+        name: "{{ container_name_proxy }}"
+      register: ret_container_proxy
+
+    - name: MOLECULE | VERIFY | TEST | CONTAINER PROXY | Check that the container exists.
+      ansible.builtin.debug:
+        msg: "The container '{{ container_name_proxy }}' {{ 'exists' if ret_container_proxy.exists else 'does not exist' }}"
+      failed_when: ret_container_proxy.exists | bool is not true
+
+    - name: MOLECULE | VERIFY | TEST | CONTAINER PROXY | Check that the container is running.
+      ansible.builtin.debug:
+        msg: "The container '{{ container_name_proxy }}' is running"
+      failed_when: ret_container_proxy.container.State.Status != 'running'
diff --git a/roles/docker_containers/tasks/printer_compose_up.yml b/roles/docker_containers/tasks/printer_compose_up.yml
index b621ae3..d576754 100644
--- a/roles/docker_containers/tasks/printer_compose_up.yml
+++ b/roles/docker_containers/tasks/printer_compose_up.yml
@@ -3,7 +3,6 @@
 
 - name: COMPOSE UP | Run `docker compose up`
   community.docker.docker_compose_v2:
-    # project_src: "{{ c3infodesk_project_src }}"
     project_src: "{{ c3infodesk_printer_folder_docker }}"
     state: present
   register: ret_docker_compose_up
diff --git a/roles/docker_containers/tasks/printer_host_cups_disable.yml b/roles/docker_containers/tasks/printer_host_cups_disable.yml
index f722c20..c6d6a48 100644
--- a/roles/docker_containers/tasks/printer_host_cups_disable.yml
+++ b/roles/docker_containers/tasks/printer_host_cups_disable.yml
@@ -9,11 +9,6 @@
     cups_status: "{{ ansible_facts.services['cups.service'].status }}"
   when: ansible_facts.services['cups.service'].status is defined
 
-- name: DISABLE CUPS | DEBUG -> Print cups_status
-  ansible.builtin.debug:
-    msg: "cups_status: {{ cups_status }}"
-  when: c3infodesk_printer_host_cups_disable_debug | bool
-
 - name: DISABLE CUPS | Stop the running CUPS on target
   ansible.builtin.command:
     cmd: systemctl stop cups
@@ -28,7 +23,6 @@
   ansible.builtin.command:
     cmd: systemctl disable cups
   become: true
-  # when: cups_status != 'masked'
   when:
     - cups_status is defined
     - cups_status != 'masked'
@@ -39,7 +33,6 @@
   ansible.builtin.command:
     cmd: systemctl mask cups
   become: true
-  # when: cups_status != 'masked'
   when:
     - cups_status is defined
     - cups_status != 'masked'
diff --git a/roles/docker_images/README.md b/roles/docker_images/README.md
index 82f422b..0a86c6b 100644
--- a/roles/docker_images/README.md
+++ b/roles/docker_images/README.md
@@ -1,4 +1,4 @@
-# docker_images
+# docker_images role
 
 This ansible-role for dealing with creating the docker images necessary for deploying the system used from **c3infodesk**.
 
diff --git a/roles/docker_images/molecule/default/converge.yml b/roles/docker_images/molecule/default/converge.yml
index 2e56f07..afd46e5 100644
--- a/roles/docker_images/molecule/default/converge.yml
+++ b/roles/docker_images/molecule/default/converge.yml
@@ -3,34 +3,34 @@
 - name: MOLECULE | Converge
   hosts: all
   pre_tasks:
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../defaults
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../defaults
       ansible.builtin.include_vars:
         dir: ../../defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../roles/dependencies/defaults
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/dependencies/defaults
       ansible.builtin.include_vars:
         dir: ../../../../roles/dependencies/defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../roles/clone_repositories/defaults
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/clone_repositories/defaults
       ansible.builtin.include_vars:
         dir: ../../../../roles/clone_repositories/defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../../../inventories/group_vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/group_vars
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../../../inventories/host_vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/host_vars
         extensions:
diff --git a/roles/docker_images/molecule/default/verify.yml b/roles/docker_images/molecule/default/verify.yml
index ef92a2e..073c4b2 100644
--- a/roles/docker_images/molecule/default/verify.yml
+++ b/roles/docker_images/molecule/default/verify.yml
@@ -9,34 +9,34 @@
     package_name_docker_compose_plugin: 'docker-compose-plugin'
 
   pre_tasks:
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../defaults
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../defaults
       ansible.builtin.include_vars:
         dir: ../../defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../roles/dependencies/defaults
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/dependencies/defaults
       ansible.builtin.include_vars:
         dir: ../../../../roles/dependencies/defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | VERIFY | PRE-TASKS | Adding variables from -> ../../../../roles/clone_repositories/defaults
+    - name: MOLECULE | VERIFY | PRE-TASKS | VARIABLES | From -> ../../../../roles/clone_repositories/defaults
       ansible.builtin.include_vars:
         dir: ../../../../roles/clone_repositories/defaults
         depth: 1
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../../../inventories/group_vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/group_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/group_vars
         extensions:
           - 'yml'
 
-    - name: MOLECULE | COVERGE | PRE-TASKS | Adding variables from -> ../../../../inventories/host_vars
+    - name: MOLECULE | COVERGE | PRE-TASKS | VARIABLES | From -> ../../../../inventories/host_vars
       ansible.builtin.include_vars:
         dir: ../../../../inventories/host_vars
         extensions:
-- 
GitLab