Skip to content
Snippets Groups Projects
Commit 209a82d0 authored by fejao's avatar fejao
Browse files

Merge branch 'Adding_role_oh_my_bash_submodule' into 'main'

Adding role oh my bash submodule

See merge request !30
parents a8745156 2d7d1c24
No related branches found
No related tags found
1 merge request!30Adding role oh my bash submodule
Pipeline #37890 passed
Showing
with 53 additions and 227 deletions
......@@ -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
......@@ -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
![fejao logo](files/from_authors/fejao_logo_circle.png "fejao") [https://chaos.social/@fejao](https://chaos.social/@fejao)
## Author Information
[https://chaos.social/@fejao](https://chaos.social/@fejao)
......@@ -5,4 +5,5 @@
hosts:
- example_servers_group
roles:
- roles/oh_my_bash
# - roles/oh_my_bash
- roles/c3infodesk-deployment-role-oh-my-bash
......@@ -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
......@@ -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
......
......@@ -5,4 +5,5 @@
hosts:
- example_servers_group
roles:
- roles/test
# - roles/test
- roles/c3infodesk-deployment-role-test
......@@ -5,4 +5,5 @@
hosts:
- example_servers_group
roles:
- roles/dependencies
# - roles/dependencies
- roles/c3infodesk-deployment-role-dependencies
......@@ -5,4 +5,5 @@
hosts:
- example_servers_group
roles:
- roles/clone_repositories
# - roles/clone_repositories
- roles/c3infodesk-deployment-role-clone-repositories
......@@ -5,4 +5,5 @@
hosts:
- example_servers_group
roles:
- roles/docker_images
# - roles/docker_images
- roles/c3infodesk-deployment-role-docker-images
......@@ -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
......
......@@ -5,4 +5,5 @@
hosts:
- example_servers_group
roles:
- roles/oh_my_bash
# - roles/oh_my_bash
- roles/c3infodesk-deployment-role-oh-my-bash
Subproject commit 64a5cf11cacf1001948d428fb773420ccdcbf3b8
Subproject commit 148909952dd355b014a8454c76b0191f3fbf43e2
Subproject commit a2ed9743b99077c3093b982db76bb69ecff8cd07
Subproject commit 062295b36de1cc472fdaaf9c9a81d7ee097f2486
Subproject commit c0e558b1ccd7a12cf64e17d6d30bd2b09d03ae0e
Subproject commit d7637ffe1882101fac6af4372d7d779df9208207
Subproject commit 79f5b494c73078f54c4482e938689655684399a0
Subproject commit fbbefa76db4186834aa05065c37ec0c0f9c564f9
Subproject commit a0281cc025200fd411e413fcc13d746f903ae0d1
# 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
![fejao logo](../../files/from_authors/fejao_logo_circle.png "fejao") [https://chaos.social/@fejao](https://chaos.social/@fejao)
---
# 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"
---
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.
## 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
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment