From 2d7d1c244e674f340c17f0781b85d5de13ee5e9a Mon Sep 17 00:00:00 2001 From: fejao <mail@fejao.de> Date: Thu, 13 Feb 2025 16:42:40 +0000 Subject: [PATCH] Adding role oh my bash submodule --- .gitmodules | 3 + README.md | 36 +++-- ci-cd/playbooks/06_oh_my_bash.yml | 3 +- ci-cd/templates/all-roles-b4-merge.yml | 2 +- ci-cd/templates/role-oh-my-bash.yml | 12 +- playbooks/examples/example_01_test.yml | 3 +- .../examples/example_02_dependencies.yml | 3 +- .../example_03_clone_repositories.yml | 3 +- .../examples/example_04_docker_images.yml | 3 +- .../examples/example_05_docker_containers.yml | 3 +- playbooks/examples/example_06_oh_my_bash.yml | 3 +- ...nfodesk-deployment-role-clone-repositories | 2 +- roles/c3infodesk-deployment-role-dependencies | 2 +- ...infodesk-deployment-role-docker-containers | 2 +- .../c3infodesk-deployment-role-docker-images | 2 +- roles/c3infodesk-deployment-role-oh-my-bash | 1 + roles/oh_my_bash/README.md | 126 ------------------ roles/oh_my_bash/defaults/main.yml | 15 --- roles/oh_my_bash/meta/main.yml | 14 -- roles/oh_my_bash/molecule/README.md | 42 ------ .../oh_my_bash/molecule/default/converge.yml | 28 ---- .../oh_my_bash/molecule/default/molecule.yml | 68 ---------- roles/oh_my_bash/molecule/default/verify.yml | 73 ---------- roles/oh_my_bash/tasks/change_theme.yml | 35 ----- .../oh_my_bash/tasks/install_dependencies.yml | 11 -- roles/oh_my_bash/tasks/install_oh_my_bash.yml | 39 ------ roles/oh_my_bash/tasks/main.yml | 12 -- 27 files changed, 53 insertions(+), 493 deletions(-) create mode 160000 roles/c3infodesk-deployment-role-oh-my-bash delete mode 100644 roles/oh_my_bash/README.md delete mode 100644 roles/oh_my_bash/defaults/main.yml delete mode 100644 roles/oh_my_bash/meta/main.yml delete mode 100644 roles/oh_my_bash/molecule/README.md delete mode 100644 roles/oh_my_bash/molecule/default/converge.yml delete mode 100644 roles/oh_my_bash/molecule/default/molecule.yml delete mode 100644 roles/oh_my_bash/molecule/default/verify.yml delete mode 100644 roles/oh_my_bash/tasks/change_theme.yml delete mode 100644 roles/oh_my_bash/tasks/install_dependencies.yml delete mode 100644 roles/oh_my_bash/tasks/install_oh_my_bash.yml delete mode 100644 roles/oh_my_bash/tasks/main.yml diff --git a/.gitmodules b/.gitmodules index 5f283b7..0b6996b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "roles/c3infodesk-deployment-role-docker-containers"] path = roles/c3infodesk-deployment-role-docker-containers url = git@git.cccv.de:fejao/c3infodesk-deployment-role-docker-containers.git +[submodule "roles/c3infodesk-deployment-role-oh-my-bash"] + path = roles/c3infodesk-deployment-role-oh-my-bash + url = git@git.cccv.de:fejao/c3infodesk-deployment-role-oh-my-bash.git diff --git a/README.md b/README.md index c196eba..513ffa0 100644 --- a/README.md +++ b/README.md @@ -17,33 +17,48 @@ - [x] [oh_my_bash](https://git.cccv.de/fejao/c3infodesk-deployment/-/commit/6bf23eb4335ad92ba42b9d1872abf497aed735cc) - [x] Set ansible-lint for the roles. - [ ] Add molecule tests to CI-CD + - CI-CD tests can't run **molecule** tests on this server because **DIND (docker in docker)** is not setted to be used :( ## What is this? This is a repo for deploying the the printer system used at the c3infodesk for printing EXTREMILY NECESSARY documents. + ## Dependencies To have [ansible](https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html) installed at your system. + ## Roles Here are the used roles: -- [dependencies](roles/dependencies/README.md) -- [clone_repositories](roles/clone_repositories/README.md) -- [docker_images](roles/docker_images/README.md) -- [docker_containers](roles/docker_containers/README.md) +- [dependencies(role)](https://git.cccv.de/fejao/c3infodesk-deployment-role-dependencies) +- [clone_repositories](https://git.cccv.de/fejao/c3infodesk-deployment-role-clone-repositories) +- [docker_images](https://git.cccv.de/fejao/c3infodesk-deployment-role-docker-images) +- [docker_containers](https://git.cccv.de/fejao/c3infodesk-deployment-role-docker-containers) +- [oh_my_bash](https://git.cccv.de/fejao/c3infodesk-deployment-role-oh-my-bash) + +The roles are setted as **git submodules**. + +For adding this roles to this repository, you need to start/init the submodules. You can do it by runnig this command: + +```bash +git submodule update --init +``` + ## How to use this - 1. Clone this repo. -- 2. Edit the files. +- 2. Init the submodules +- 3. Edit the files. - Set your **remote_user** configuration at the **ansible.cfg** file. - Set your **inventories/host_vars/<TARGET_NAME>** file. -- 3. Run the playbooks +- 4. Run the playbooks - Example for deploying the containers at the target: ```bash ansible-playbook -i inventories/hosts playbooks/examples/example_05_docker_containers.yml ``` -- 4. Change the default environment variables setted from the [docker-compose.yml](https://git.cccv.de/fejao/c3infodesk-printer/-/blob/main/docker/docker-compose.yml) file to your needs and recreate the containers. You might need to login at the **target** for doing it so. +- 5. Change the default environment variables setted from the [docker-compose.yml](https://git.cccv.de/fejao/c3infodesk-printer/-/blob/main/docker/docker-compose.yml) file to your needs and recreate the containers. You might need to login at the **target** for doing it so. + ## Local testing At the moment, the only tests setted CI-CD are. @@ -62,10 +77,7 @@ At the moment, the only tests setted CI-CD are. MIT / BSD -## Author Information - - [https://chaos.social/@fejao](https://chaos.social/@fejao) - - +## Author Information +[https://chaos.social/@fejao](https://chaos.social/@fejao) diff --git a/ci-cd/playbooks/06_oh_my_bash.yml b/ci-cd/playbooks/06_oh_my_bash.yml index 836fbfa..94a37dd 100644 --- a/ci-cd/playbooks/06_oh_my_bash.yml +++ b/ci-cd/playbooks/06_oh_my_bash.yml @@ -5,4 +5,5 @@ hosts: - example_servers_group roles: - - roles/oh_my_bash + # - roles/oh_my_bash + - roles/c3infodesk-deployment-role-oh-my-bash diff --git a/ci-cd/templates/all-roles-b4-merge.yml b/ci-cd/templates/all-roles-b4-merge.yml index bd7b101..b324418 100644 --- a/ci-cd/templates/all-roles-b4-merge.yml +++ b/ci-cd/templates/all-roles-b4-merge.yml @@ -15,4 +15,4 @@ include: - local: ci-cd/templates/role-clone-repositories.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 + - local: ci-cd/templates/role-oh-my-bash.yml diff --git a/ci-cd/templates/role-oh-my-bash.yml b/ci-cd/templates/role-oh-my-bash.yml index da969ce..869bbcb 100644 --- a/ci-cd/templates/role-oh-my-bash.yml +++ b/ci-cd/templates/role-oh-my-bash.yml @@ -15,28 +15,28 @@ include: ### ### SYNTAX ### -syntax-clone-repositories: +syntax-oh-my-bash: stage: syntax-checks image: $IMAGE_NAME_SYNTAX extends: .script_syntax_check_main variables: - PLAYBOOK_PATH: $PATH_PLAYBOOK_FOR_ROLE_CLONE_REPOSITORIES + PLAYBOOK_PATH: $PATH_PLAYBOOK_FOR_ROLE_OH_MY_BASH # only: # changes: - # - roles/c3infodesk-deployment-role-clone-repositories + # - roles/c3infodesk-deployment-role-oh-my-bash ### ### LINT ### -lint-clone-repositories: +lint-oh-my-bash: stage: lint-tests image: $IMAGE_NAME_LINT extends: .run_lint variables: - PLAYBOOK_PATH: $PATH_PLAYBOOK_FOR_ROLE_CLONE_REPOSITORIES + PLAYBOOK_PATH: $PATH_PLAYBOOK_FOR_ROLE_OH_MY_BASH # only: # changes: - # - roles/c3infodesk-deployment-role-clone-repositories + # - roles/c3infodesk-deployment-role-oh-my-bash ### ### MOLECULE diff --git a/playbooks/examples/example_01_test.yml b/playbooks/examples/example_01_test.yml index 6580445..891798b 100644 --- a/playbooks/examples/example_01_test.yml +++ b/playbooks/examples/example_01_test.yml @@ -5,4 +5,5 @@ hosts: - example_servers_group roles: - - roles/test + # - roles/test + - roles/c3infodesk-deployment-role-test diff --git a/playbooks/examples/example_02_dependencies.yml b/playbooks/examples/example_02_dependencies.yml index 9d881c1..0c8c203 100644 --- a/playbooks/examples/example_02_dependencies.yml +++ b/playbooks/examples/example_02_dependencies.yml @@ -5,4 +5,5 @@ hosts: - example_servers_group roles: - - roles/dependencies + # - roles/dependencies + - roles/c3infodesk-deployment-role-dependencies diff --git a/playbooks/examples/example_03_clone_repositories.yml b/playbooks/examples/example_03_clone_repositories.yml index e0fd12f..8659519 100644 --- a/playbooks/examples/example_03_clone_repositories.yml +++ b/playbooks/examples/example_03_clone_repositories.yml @@ -5,4 +5,5 @@ hosts: - example_servers_group roles: - - roles/clone_repositories + # - roles/clone_repositories + - roles/c3infodesk-deployment-role-clone-repositories diff --git a/playbooks/examples/example_04_docker_images.yml b/playbooks/examples/example_04_docker_images.yml index a3ad2dd..00fbec9 100644 --- a/playbooks/examples/example_04_docker_images.yml +++ b/playbooks/examples/example_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/playbooks/examples/example_05_docker_containers.yml b/playbooks/examples/example_05_docker_containers.yml index 54c92cd..342a556 100644 --- a/playbooks/examples/example_05_docker_containers.yml +++ b/playbooks/examples/example_05_docker_containers.yml @@ -4,7 +4,8 @@ hosts: - example_servers_group roles: - - role: roles/docker_containers + # - role: roles/docker_containers + - role: roles/c3infodesk-deployment-role-docker-containers vars: c3infodesk_printer_host_cups_disable: true c3infodesk_printer_host_cups_mask: true diff --git a/playbooks/examples/example_06_oh_my_bash.yml b/playbooks/examples/example_06_oh_my_bash.yml index 869f62b..9917694 100644 --- a/playbooks/examples/example_06_oh_my_bash.yml +++ b/playbooks/examples/example_06_oh_my_bash.yml @@ -5,4 +5,5 @@ hosts: - example_servers_group roles: - - roles/oh_my_bash + # - roles/oh_my_bash + - roles/c3infodesk-deployment-role-oh-my-bash diff --git a/roles/c3infodesk-deployment-role-clone-repositories b/roles/c3infodesk-deployment-role-clone-repositories index 64a5cf1..1489099 160000 --- a/roles/c3infodesk-deployment-role-clone-repositories +++ b/roles/c3infodesk-deployment-role-clone-repositories @@ -1 +1 @@ -Subproject commit 64a5cf11cacf1001948d428fb773420ccdcbf3b8 +Subproject commit 148909952dd355b014a8454c76b0191f3fbf43e2 diff --git a/roles/c3infodesk-deployment-role-dependencies b/roles/c3infodesk-deployment-role-dependencies index a2ed974..062295b 160000 --- a/roles/c3infodesk-deployment-role-dependencies +++ b/roles/c3infodesk-deployment-role-dependencies @@ -1 +1 @@ -Subproject commit a2ed9743b99077c3093b982db76bb69ecff8cd07 +Subproject commit 062295b36de1cc472fdaaf9c9a81d7ee097f2486 diff --git a/roles/c3infodesk-deployment-role-docker-containers b/roles/c3infodesk-deployment-role-docker-containers index c0e558b..d7637ff 160000 --- a/roles/c3infodesk-deployment-role-docker-containers +++ b/roles/c3infodesk-deployment-role-docker-containers @@ -1 +1 @@ -Subproject commit c0e558b1ccd7a12cf64e17d6d30bd2b09d03ae0e +Subproject commit d7637ffe1882101fac6af4372d7d779df9208207 diff --git a/roles/c3infodesk-deployment-role-docker-images b/roles/c3infodesk-deployment-role-docker-images index 79f5b49..fbbefa7 160000 --- a/roles/c3infodesk-deployment-role-docker-images +++ b/roles/c3infodesk-deployment-role-docker-images @@ -1 +1 @@ -Subproject commit 79f5b494c73078f54c4482e938689655684399a0 +Subproject commit fbbefa76db4186834aa05065c37ec0c0f9c564f9 diff --git a/roles/c3infodesk-deployment-role-oh-my-bash b/roles/c3infodesk-deployment-role-oh-my-bash new file mode 160000 index 0000000..a0281cc --- /dev/null +++ b/roles/c3infodesk-deployment-role-oh-my-bash @@ -0,0 +1 @@ +Subproject commit a0281cc025200fd411e413fcc13d746f903ae0d1 diff --git a/roles/oh_my_bash/README.md b/roles/oh_my_bash/README.md deleted file mode 100644 index 7ab2512..0000000 --- a/roles/oh_my_bash/README.md +++ /dev/null @@ -1,126 +0,0 @@ -# oh_my_bash role - -This ansible-role for installing [oh-my-bash](https://github.com/ohmybash/oh-my-bash) at the **c3infodesk** systems. - -## 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> - No variable setted at this file - -- ### From: inventories/group_vars/<TARGET_GROUP> - No variable setted at this file - -- ### 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 - - **oh_my_bash_dependencies_list**: DEFAULT=["bash-completion","curl","git","vim"] - - **oh_my_bash_dependencies_state**: DEFAULT=present - - **oh_my_bash_debug**: DEAFULT=false - - **oh_my_bash_download_url**: DEFAULT="https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh" - - **oh_my_bash_download_dest**: DEAFULT="/tmp/install_ohmybash.sh" - - **oh_my_bash_installed_path**: DEAFULT="~/.oh-my-bash" - - **oh_my_bash_change_theme**: DEAFULT=true - - **oh_my_bash_theme_name**: DEAFULT="pzq" - - -## Dependencies -This role have no dependency from any another role. - - -## Example Playbook - -- ### Using the provided example - For using the example playbook **[playbooks/examples/example_06_oh_my_bash.yml](https://git.cccv.de/fejao/c3infodesk-deployment/-/blob/main/playbooks/examples/example_06_oh_my_bash.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_06_oh_my_bash.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/oh_my_bash - ``` - - 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/oh_my_bash/defaults/main.yml b/roles/oh_my_bash/defaults/main.yml deleted file mode 100644 index 7d26b1e..0000000 --- a/roles/oh_my_bash/defaults/main.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# defaults file for oh-my-bash - -oh_my_bash_dependencies_list: - - "bash-completion" - - "curl" - - "git" -oh_my_bash_dependencies_state: present - -oh_my_bash_debug: false -oh_my_bash_download_url: "https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh" -oh_my_bash_download_dest: "/tmp/install_ohmybash.sh" -oh_my_bash_installed_path: "~/.oh-my-bash" -oh_my_bash_change_theme: true -oh_my_bash_theme_name: "pzq" diff --git a/roles/oh_my_bash/meta/main.yml b/roles/oh_my_bash/meta/main.yml deleted file mode 100644 index beb0677..0000000 --- a/roles/oh_my_bash/meta/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- - -galaxy_info: - role_name: oh_my_bash - description: Role to install Oh-My-Bash on the target. - 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. diff --git a/roles/oh_my_bash/molecule/README.md b/roles/oh_my_bash/molecule/README.md deleted file mode 100644 index 81b4e59..0000000 --- a/roles/oh_my_bash/molecule/README.md +++ /dev/null @@ -1,42 +0,0 @@ -## ansible molecule tests for role: dependencies - - - -## 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/oh_my_bash/molecule/default/converge.yml b/roles/oh_my_bash/molecule/default/converge.yml deleted file mode 100644 index cf5b357..0000000 --- a/roles/oh_my_bash/molecule/default/converge.yml +++ /dev/null @@ -1,28 +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 | 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: - - name: MOLECULE | CONVERGE | Call the 'oh_my_bash' role. - ansible.builtin.include_role: - name: oh_my_bash diff --git a/roles/oh_my_bash/molecule/default/molecule.yml b/roles/oh_my_bash/molecule/default/molecule.yml deleted file mode 100644 index 62cffd6..0000000 --- a/roles/oh_my_bash/molecule/default/molecule.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- - -dependency: - name: galaxy - -driver: - name: docker - -platforms: - - name: molecule_oh_my_bash - ### 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/oh_my_bash/molecule/default/verify.yml b/roles/oh_my_bash/molecule/default/verify.yml deleted file mode 100644 index dfef6dc..0000000 --- a/roles/oh_my_bash/molecule/default/verify.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- - -- name: VERIFY | Test role for debugging variables - hosts: all - 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 -> ../../../../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 - - ## - ## TESTS - PACKAGES - ## - - name: MOLECULE | VERIFY | TEST | Check that the packages from 'oh_my_bash_dependencies_list' are installed. - ansible.builtin.debug: - msg: "Package: '{{ package_name }}' is installed" - loop: "{{ oh_my_bash_dependencies_list }}" - loop_control: - loop_var: package_name - failed_when: package_name not in ansible_facts.packages - - ### - ### TESTS - CHECK INSTALL - ### - - name: MOLECULE | VERIFY | TEST | Oh-My-Bash installed. - ansible.builtin.stat: - path: "{{ oh_my_bash_installed_path }}" - register: check_installed - failed_when: - - not check_installed.stat.exists - - - name: MOLECULE | VERIFY | TEST | Oh-My-Bash is enabled. - ansible.builtin.lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: "export OSH='/root/.oh-my-bash'" - state: present - check_mode: true - register: check_enabled - failed_when: check_enabled.changed | bool - - - name: MOLECULE | VERIFY | TEST | Theme is setted. - ansible.builtin.lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - line: 'OSH_THEME="{{ oh_my_bash_theme_name }}"' - state: present - check_mode: true - register: check_theme_set - failed_when: check_theme_set.changed | bool - when: - - oh_my_bash_theme_name is defined - - not check_enabled.changed | bool diff --git a/roles/oh_my_bash/tasks/change_theme.yml b/roles/oh_my_bash/tasks/change_theme.yml deleted file mode 100644 index 409c5c1..0000000 --- a/roles/oh_my_bash/tasks/change_theme.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -# tasks for changing oh-my-bash theme - -### CHECK -- name: THEME | CHECK | Test Oh-My-Bash installation. - ansible.builtin.stat: - path: "{{ oh_my_bash_installed_path }}" - register: install_check - -- name: THEME | CHECK | Test theme installation. - ansible.builtin.lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - # line: 'OSH_THEME="pzq"' - line: 'OSH_THEME="{{ oh_my_bash_theme_name }}"' - state: present - check_mode: true - register: theme_installed - when: - - oh_my_bash_theme_name is defined - - install_check.stat.exists | bool - -- name: THEME | CHECK | Test theme installation response. - ansible.builtin.debug: - msg: "{{ 'Theme not installed, installing...' if theme_installed.changed else 'Theme already installed...' }}" - -### INSTALL -- name: THEME | CHANGE | Set the Theme. - ansible.builtin.lineinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - regexp: '^.*OSH_THEME=.*$' - # insertafter: '^OSH_THEME' - line: OSH_THEME="{{ oh_my_bash_theme_name }}" - when: - - oh_my_bash_theme_name is defined - - theme_installed.changed | bool diff --git a/roles/oh_my_bash/tasks/install_dependencies.yml b/roles/oh_my_bash/tasks/install_dependencies.yml deleted file mode 100644 index a83260a..0000000 --- a/roles/oh_my_bash/tasks/install_dependencies.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- - -- name: DEPENDENCIES | Installing the packages from list - ansible.builtin.package: - name: "{{ package_name }}" - state: "{{ oh_my_bash_dependencies_state }}" - update_cache: true - loop: "{{ oh_my_bash_dependencies_list }}" - loop_control: - loop_var: package_name - become: true diff --git a/roles/oh_my_bash/tasks/install_oh_my_bash.yml b/roles/oh_my_bash/tasks/install_oh_my_bash.yml deleted file mode 100644 index d432dab..0000000 --- a/roles/oh_my_bash/tasks/install_oh_my_bash.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -# tasks file for oh-my-bash - - -### CHECK INSTALL -- name: INSTALL | Test Oh-My-Bash installation. - ansible.builtin.stat: - path: "{{ oh_my_bash_installed_path }}" - register: check_if_installed - -- name: INSTALL | Check if Oh-My-Bash already installed. - ansible.builtin.debug: - msg: "{{ 'Oh-My-Bash already installed' if check_if_installed.stat.exists == True else 'Oh-My-Bash not installed, installing...' }}" - -### DOWNLOAD -- name: INSTALL | Download installation script. - ansible.builtin.get_url: - url: "{{ oh_my_bash_download_url }}" - dest: "{{ oh_my_bash_download_dest }}" - mode: "0777" - register: install_script_downloaded - when: - - check_if_installed is defined - - not check_if_installed.stat.exists | bool - -### INSTALL -- name: INSTALL | Runs the installation script. - ansible.builtin.command: - cmd: "{{ oh_my_bash_download_dest }} --unattended" - vars: - ansible_command_timeout: 15 - register: install_result - when: - - install_script_downloaded.failed is defined - - not install_script_downloaded.failed | bool - changed_when: install_result.rc != 0 - -- name: INSTALL | Reset ssh connection to apply user changes. - ansible.builtin.meta: reset_connection diff --git a/roles/oh_my_bash/tasks/main.yml b/roles/oh_my_bash/tasks/main.yml deleted file mode 100644 index 0cdcc08..0000000 --- a/roles/oh_my_bash/tasks/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# tasks file for oh-my-bash - -- name: Install dependencies - ansible.builtin.import_tasks: install_dependencies.yml - -- name: Install Oh-My-Bash - ansible.builtin.import_tasks: install_oh_my_bash.yml - -- name: Change Theme - ansible.builtin.import_tasks: change_theme.yml - when: oh_my_bash_change_theme | bool -- GitLab