clank-manage/roles/repos/renovate/tasks/main.yml
kjuulh 7e73d346ce
fix(hosts): update ansible_host IP address to use internal IP for better security
The ansible_host IP address is changed from the public IP to the internal IP (10.0.9.9) to improve security by using internal networking for communication.

feat(renovate/tasks/main.yml): add renovate clean cron job to maintain a clean environment
A new cron job is added to run twice daily at 2 AM and 2 PM. This job will clean up the environment by running `docker-compose down -v --remove-orphans` and then starting the services again with `docker-compose up -d`. The output is logged to /var/log/renovate-clean.log for monitoring purposes. This ensures a clean environment and helps prevent potential issues caused by stale or orphaned containers.
2023-05-13 02:58:48 +02:00

35 lines
1.1 KiB
YAML

- name: Clone private Git repository
git:
repo: https://git:{{ git_token }}@git.front.kjuulh.io/kjuulh/renovate.git
dest: ~/git/git.front.kjuulh.io/kjuulh/renovate
version: main
force: yes
- name: Ensure Docker Compose file exists
stat:
path: ~/git/git.front.kjuulh.io/kjuulh/renovate/docker-compose.yaml
register: compose_file_stat
- name: Ensure .github.env exists
stat:
path: ~/git/git.front.kjuulh.io/kjuulh/renovate/.github.env
register: github_env_stat
- name: Ensure .env exists
stat:
path: ~/git/git.front.kjuulh.io/kjuulh/renovate/.env
register: env_stat
- name: Run Docker Compose
docker_compose:
project_src: ~/git/git.front.kjuulh.io/kjuulh/renovate/
when: compose_file_stat.stat.exists and github_env_stat.stat.exists and env_stat.stat.exists
- name: renovate clean cron job
cron:
name: renovate clean cronjob
user: "root"
minute: "0"
hour: "2,14"
job: "docker-compose -f ~/git/git.front.kjuulh.io/kjuulh/renovate/docker-compose.yaml down -v --remove-orphans && docker-compose -f ~/git/git.front.kjuulh.io/kjuulh/renovate/docker-compose.yaml up -d >> /var/log/renovate-clean.log 2>&1"