From 52971bf6e6f73ad8e320c3299d65e31b47b158c8 Mon Sep 17 00:00:00 2001 From: fejao <mail@fejao.de> Date: Wed, 12 Feb 2025 19:10:52 +0000 Subject: [PATCH] Adding role docker images submodule --- .gitmodules | 3 + ci-cd/playbooks/04_docker_images.yml | 3 +- ci-cd/templates/all-roles-b4-merge.yml | 2 +- ...nfodesk-deployment-role-clone-repositories | 2 +- .../c3infodesk-deployment-role-docker-images | 1 + roles/docker_images/README.md | 149 --------------- roles/docker_images/defaults/main.yml | 6 - roles/docker_images/meta/main.yml | 17 -- roles/docker_images/molecule/README.md | 42 ----- .../molecule/default/converge.yml | 46 ----- .../molecule/default/molecule.yml | 68 ------- .../docker_images/molecule/default/verify.yml | 174 ------------------ .../docker_images/tasks/docker_image_app.yml | 28 --- .../docker_images/tasks/docker_image_cups.yml | 33 ---- .../tasks/docker_image_proxy.yml | 28 --- roles/docker_images/tasks/main.yml | 11 -- 16 files changed, 8 insertions(+), 605 deletions(-) create mode 160000 roles/c3infodesk-deployment-role-docker-images delete mode 100644 roles/docker_images/README.md delete mode 100644 roles/docker_images/defaults/main.yml delete mode 100644 roles/docker_images/meta/main.yml delete mode 100644 roles/docker_images/molecule/README.md delete mode 100644 roles/docker_images/molecule/default/converge.yml delete mode 100644 roles/docker_images/molecule/default/molecule.yml delete mode 100644 roles/docker_images/molecule/default/verify.yml delete mode 100644 roles/docker_images/tasks/docker_image_app.yml delete mode 100644 roles/docker_images/tasks/docker_image_cups.yml delete mode 100644 roles/docker_images/tasks/docker_image_proxy.yml delete mode 100644 roles/docker_images/tasks/main.yml diff --git a/.gitmodules b/.gitmodules index 009d026..86c8d23 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "roles/c3infodesk-deployment-role-clone-repositories"] path = roles/c3infodesk-deployment-role-clone-repositories url = git@git.cccv.de:fejao/c3infodesk-deployment-role-clone-repositories.git +[submodule "roles/c3infodesk-deployment-role-docker-images"] + path = roles/c3infodesk-deployment-role-docker-images + url = git@git.cccv.de:fejao/c3infodesk-deployment-role-docker-images.git diff --git a/ci-cd/playbooks/04_docker_images.yml b/ci-cd/playbooks/04_docker_images.yml index 9425ffc..136f55b 100644 --- a/ci-cd/playbooks/04_docker_images.yml +++ b/ci-cd/playbooks/04_docker_images.yml @@ -5,4 +5,5 @@ hosts: - example_servers_group roles: - - roles/docker_images + # - roles/docker_images + - roles/c3infodesk-deployment-role-docker-images diff --git a/ci-cd/templates/all-roles-b4-merge.yml b/ci-cd/templates/all-roles-b4-merge.yml index 8539a42..06911f9 100644 --- a/ci-cd/templates/all-roles-b4-merge.yml +++ b/ci-cd/templates/all-roles-b4-merge.yml @@ -13,6 +13,6 @@ include: - local: ci-cd/templates/role-test.yml - local: ci-cd/templates/role-dependencies.yml - local: ci-cd/templates/role-clone-repositories.yml - # - local: ci-cd/templates/role-docker-images.yml + - local: ci-cd/templates/role-docker-images.yml # - local: ci-cd/templates/role-docker-containers.yml # - local: ci-cd/templates/role-oh-my-bash.yml diff --git a/roles/c3infodesk-deployment-role-clone-repositories b/roles/c3infodesk-deployment-role-clone-repositories index 78e237c..64a5cf1 160000 --- a/roles/c3infodesk-deployment-role-clone-repositories +++ b/roles/c3infodesk-deployment-role-clone-repositories @@ -1 +1 @@ -Subproject commit 78e237cf0cde7aa64ea21f4a17d4964bfbf57433 +Subproject commit 64a5cf11cacf1001948d428fb773420ccdcbf3b8 diff --git a/roles/c3infodesk-deployment-role-docker-images b/roles/c3infodesk-deployment-role-docker-images new file mode 160000 index 0000000..4abadfb --- /dev/null +++ b/roles/c3infodesk-deployment-role-docker-images @@ -0,0 +1 @@ +Subproject commit 4abadfb5e53c31034e2aae072c6c420c4227bc4b diff --git a/roles/docker_images/README.md b/roles/docker_images/README.md deleted file mode 100644 index 9ce6c87..0000000 --- a/roles/docker_images/README.md +++ /dev/null @@ -1,149 +0,0 @@ -# docker_images role - -This ansible-role for dealing with creating the docker images necessary for deploying the system used from **c3infodesk**. - -## Requirements -- To have [ansible](https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html) installed at your system. - - -## 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: - -- ### From: inventories/host_vars/<TARGET_NAME> - Here are the variables that you should be changing for your own deployment. - - **c3infodesk_printer_debug_create_image_cups**: DEFAULT=<NOT_SETTED> - - If you want to debug the output from creating the image for CUPS - - **c3infodesk_printer_debug_create_image_app**: DEFAULT=<NOT_SETTED> - - If you want to debug the output from creating the image for the APP - - **c3infodesk_printer_debug_create_image_proxy**: DEFAULT=<NOT_SETTED> - - If you want to debug the output from creating the image for the PROXY - -- ### From: inventories/group_vars/<TARGET_GROUP> - Please don't cahnge the default values at this file. If you need to update them, use the **inventories/host_vars/<TARGET_NAME>** file. - - **c3infodesk_printer_folder_docker**: DEFAULT="Coding/c3infodesk-printer/docker" - - The folder where the configuration from docker used for the system - - **c3infodesk_printer_folder_docker_cups**: DEFAULT="Coding/c3infodesk-printer/docker/cups" - - The folder where the configuration from docker CUPS used for the system - - **c3infodesk_printer_folder_docker_app**: DEFAULT="Coding/c3infodesk-printer/docker/app" - - The folder where the configuration from docker APP used for the system - - **c3infodesk_printer_folder_docker_proxy**: DEFAULT="Coding/c3infodesk-printer/docker/proxy" - - The folder where the configuration from docker PROXY used for the system - - **c3infodesk_printer_docker_img_cups_name**: DEFAULT="c3printing-cups" - - The name of the image to be set for the CUPS - - **c3infodesk_printer_docker_img_cups_tag**: DEFAULT="latest" - - The tag name/number to be setted for the CUPS image - - **c3infodesk_printer_docker_img_app_name**: DEFAULT="c3printing-app" - - The name of the image to be set for the APP - - **c3infodesk_printer_docker_img_app_tag**: DEFAULT="latest" - - The tag name/number to be setted for the APP image - - **c3infodesk_printer_docker_img_proxy_name**: DEFAULT="c3printing-proxy" - - The name of the image to be set for the PROXY - - **c3infodesk_printer_docker_img_proxy_tag**: DEFAULT="latest" - - The tag name/number to be setted for the PROXY image - -- ### From: roles/clone-repositories/defaults/main.yml - Don't change the values at this file, if you need to change them, change it at the **inventories/host_vars/<TARGET_NAME>** file - - **c3infodesk_printer_debug_create_image_cups**: DEFAULT=false - - **c3infodesk_printer_debug_create_image_app**: DEFAULT=false - - **c3infodesk_printer_debug_create_image_proxy**: DEFAULT=false - - -## Dependencies -The role dependencies are: - - [dependencies(role)](roles/dependencies/README.md) - - [clone_repositories](roles/clone_repositories/README.md) - - -## Example Playbook - -- ### Using the provided example - For using the example playbook **[playbooks/examples/example_04_docker_images.yml](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/playbooks/examples/example_04_docker_images.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 - ansible-playbook -i inventories/hosts playbooks/examples/example_04_docker_images.yml - ``` - -- ### Setting your own example - After setting your variables at **inventories/host_vars/<HOST_NAME>**, you can add this role to your playbook as a regular role. - - Here is an example using the **<HOST_NAME>** as **test_servers** - - ```yaml - - hosts: - - test_servers - roles: - - roles/docker_images - ``` - - And call the playbook as: - - ```bash - ansible-playbook -i <INVENTORY> <PLAYBOOK_NAME>.yml - ``` - - -## 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 - -MIT / BSD - - -## Author Information - [https://chaos.social/@fejao](https://chaos.social/@fejao) diff --git a/roles/docker_images/defaults/main.yml b/roles/docker_images/defaults/main.yml deleted file mode 100644 index 9bc853f..0000000 --- a/roles/docker_images/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# defaults file for docker-images - -c3infodesk_printer_debug_create_image_cups: false -c3infodesk_printer_debug_create_image_app: false -c3infodesk_printer_debug_create_image_proxy: false diff --git a/roles/docker_images/meta/main.yml b/roles/docker_images/meta/main.yml deleted file mode 100644 index 42a845a..0000000 --- a/roles/docker_images/meta/main.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- - -galaxy_info: - role_name: docker_images - description: Role to clone the repositories used from c3InfoDesk sytems - author: fejao - company: cccv.de - license: "MIT / BSD" - min_ansible_version: '2.10' - galaxy_tags: [] - -# dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. -dependencies: - - role: dependencies - - role: clone_repositories diff --git a/roles/docker_images/molecule/README.md b/roles/docker_images/molecule/README.md deleted file mode 100644 index 91e1d07..0000000 --- a/roles/docker_images/molecule/README.md +++ /dev/null @@ -1,42 +0,0 @@ -## ansible molecule tests for role: docker_images - - - -## 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_images/molecule/default/converge.yml b/roles/docker_images/molecule/default/converge.yml deleted file mode 100644 index afd46e5..0000000 --- a/roles/docker_images/molecule/default/converge.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- - -- name: MOLECULE | Converge - hosts: all - pre_tasks: - - name: MOLECULE | COVERGE | 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 | 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. - ansible.builtin.include_role: - name: docker_images diff --git a/roles/docker_images/molecule/default/molecule.yml b/roles/docker_images/molecule/default/molecule.yml deleted file mode 100644 index 6d58bb2..0000000 --- a/roles/docker_images/molecule/default/molecule.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- - -dependency: - name: galaxy - -driver: - name: docker - -platforms: - - name: molecule_docker_images - ### 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_images/molecule/default/verify.yml b/roles/docker_images/molecule/default/verify.yml deleted file mode 100644 index 073c4b2..0000000 --- a/roles/docker_images/molecule/default/verify.yml +++ /dev/null @@ -1,174 +0,0 @@ ---- - -- name: VERIFY | Test role for debugging variables - 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' - - pre_tasks: - - name: MOLECULE | COVERGE | 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 | 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' - - 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 diff --git a/roles/docker_images/tasks/docker_image_app.yml b/roles/docker_images/tasks/docker_image_app.yml deleted file mode 100644 index 662606d..0000000 --- a/roles/docker_images/tasks/docker_image_app.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# Creates the c3infodesk-app docker image - -- name: APP | Check if the image already exists on the system - community.docker.docker_image_info: - name: "{{ c3infodesk_printer_docker_img_app_name }}" - register: result_check_image - -- name: APP | Check image exists answer - ansible.builtin.debug: - msg: "Image already exists on target" - when: result_check_image.images | length > 0 - -- name: APP | Build the docker image - ansible.builtin.command: - cmd: docker build . -t "{{ c3infodesk_printer_docker_img_app_name }}":"{{ c3infodesk_printer_docker_img_app_tag }}" -f docker/app/Dockerfile - args: - chdir: "{{ c3infodesk_printer_folder }}" - register: build_img_result - when: result_check_image.images | length <= 0 - changed_when: build_img_result.rc != 0 - -- name: APP | DEBUG -> Output from creating the docker image - ansible.builtin.debug: - msg: "{{ build_img_result }}" - when: - - c3infodesk_printer_debug_create_image_app | bool - - build_img_result is defined diff --git a/roles/docker_images/tasks/docker_image_cups.yml b/roles/docker_images/tasks/docker_image_cups.yml deleted file mode 100644 index fdc5ac7..0000000 --- a/roles/docker_images/tasks/docker_image_cups.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -# Creates the c3infodesk-cups docker image - -### -### LINKS -### -# https://docs.ansible.com/ansible/latest/collections/community/docker/docker_image_module.html - -- name: CUPS | Check if the image already exists on the system - community.docker.docker_image_info: - name: "{{ c3infodesk_printer_docker_img_cups_name }}" - register: result_check_image - -- name: CUPS | Check image exists answer - ansible.builtin.debug: - msg: "Image already exists on target" - when: result_check_image.images | length > 0 - -- name: CUPS | Build the docker image - ansible.builtin.command: - cmd: docker build . -t "{{ c3infodesk_printer_docker_img_cups_name }}":"{{ c3infodesk_printer_docker_img_cups_tag }}" -f docker/cups/Dockerfile - args: - chdir: "{{ c3infodesk_printer_folder }}" - register: build_img_result - when: result_check_image.images | length <= 0 - changed_when: build_img_result.rc != 0 - -- name: CUPS | DEBUG -> Output from creating the docker image - ansible.builtin.debug: - msg: "{{ build_img_result }}" - when: - - c3infodesk_printer_debug_create_image_cups | bool - - build_img_result is defined diff --git a/roles/docker_images/tasks/docker_image_proxy.yml b/roles/docker_images/tasks/docker_image_proxy.yml deleted file mode 100644 index 8cb215c..0000000 --- a/roles/docker_images/tasks/docker_image_proxy.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# Creates the c3infodesk-proxy docker image - -- name: PROXY | Check if the image already exists on the system - community.docker.docker_image_info: - name: "{{ c3infodesk_printer_docker_img_proxy_name }}" - register: result_check_image - -- name: PROXY | Check image exists answer - ansible.builtin.debug: - msg: "Image already exists on target" - when: result_check_image.images | length > 0 - -- name: PROXY | Build the docker image - ansible.builtin.command: - cmd: docker build . -t "{{ c3infodesk_printer_docker_img_proxy_name }}":"{{ c3infodesk_printer_docker_img_proxy_tag }}" -f docker/proxy/Dockerfile - args: - chdir: "{{ c3infodesk_printer_folder }}" - register: build_img_result - when: result_check_image.images | length <= 0 - changed_when: build_img_result.rc != 0 - -- name: PROXY | DEBUG -> Output from creating the docker image - ansible.builtin.debug: - msg: "{{ build_img_result }}" - when: - - c3infodesk_printer_debug_create_image_cups | bool - - build_img_result is defined diff --git a/roles/docker_images/tasks/main.yml b/roles/docker_images/tasks/main.yml deleted file mode 100644 index ba59881..0000000 --- a/roles/docker_images/tasks/main.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -# tasks file for docker-images - -- name: Create the docker image for cups - ansible.builtin.import_tasks: docker_image_cups.yml - -- name: Create the docker image for app - ansible.builtin.import_tasks: docker_image_app.yml - -- name: Create the docker image for proxy - ansible.builtin.import_tasks: docker_image_proxy.yml -- GitLab