This guide explains how to create a new CyMaIs role for deploying Docker containers, using the existing docker-gitea
role as a template. The guide was generated with ChatGPT and is based on the following conversation: ChatGPT Conversation
References
- Main Repository: CyMaIs GitHub
- Existing Gitea Role: docker-gitea Role
- Playbook: playbook.servers.yml
- Domains Variables: 03_domains.yml
- Ports Variables: 09_ports.yml
Steps to Create a New Docker Role
Fork the Repository and Create a New Branch
- Navigate to CyMaIs GitHub and create a fork of the repository.
- Clone your fork locally:
git clone https://github.com/<your-username>/cymais.git cd cymais
- Create a new branch for your changes:
git checkout -b feature/docker-<your-service>
Copy the docker-gitea
Role as a Template
- Navigate to the
roles/
directory:cd cymais/roles
- Copy the
docker-gitea
role and rename it:cp -r docker-gitea docker-<your-service>
- Update
meta/main.yml
,tasks/main.yml
, anddefaults/main.yml
to match your new service.
Modify the Playbook to Include the New Role
Edit the playbook.servers.yml file and add your new role under the roles
section:
- hosts: all
roles:
- role: docker-<your-service>
Add Necessary Variables
Domains Configuration
Update the 03_domains.yml file with:
<your_service>_domain: "your-service.example.com"
Ports Configuration
Update the 09_ports.yml file with:
<your_service>_port: "<your_port>"
Set Environment Variables 
Make sure to define the necessary environment variables in the appropriate environment files. Ansible will issue warnings if variables are not set, so double-check them before deployment.
Commit and Push Your Changes
- Add your changes:
git add .
- Commit your updates:
git commit -m "Add new docker role for <your-service>"
- Push your changes to your fork:
git push origin feature/docker-<your-service>
Create a Pull Request
- Navigate to your fork on GitHub.
- Open a Pull Request (PR) against the main CyMaIs repository.
- Provide a clear description of your changes and request a review.
Final Steps
- Test your role using
ansible-playbook --check
to verify configuration. - Once everything is ready, deploy your new service!
This guide was created with the help of ChatGPT . If you have any questions or improvements, feel free to contribute to CyMaIs.