This repository was archived by the owner on Oct 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ gitlab:
4545 unicorn_worker_processes : 2
4646 puma_worker_processes : 2
4747 initial_root_password : " Ch@ng3m3"
48+ letsencrypt_timer : false
4849 # LDAP settings
4950 ldap :
5051 enable : false # enable/disable LDAP integration
Original file line number Diff line number Diff line change 138138 timer_OnCalendar : " {{ gitlab.block_removed_ldap_users_on_calendar }}"
139139 when : gitlab.ldap.enable
140140
141+ # Set up LE renewal timer and service on boot for servers that are shut down overnight.
142+
143+ - name : Check if GitLab is installed
144+ ansible.builtin.stat :
145+ path : /opt/gitlab/bin/gitlab-ctl
146+ register : gitlab_ctl_binary
147+
148+ - name : Configure GitLab LE boot-time renewal timer
149+ when :
150+ - gitlab_le_boot_timer_enabled
151+ - gitlab_ctl_binary.stat.exists
152+ block :
153+ - name : Install systemd service for LE renewal
154+ ansible.builtin.template :
155+ src : gitlab-renew-le.service.j2
156+ dest : /etc/systemd/system/gitlab-renew-le.service
157+ owner : root
158+ group : root
159+ mode : ' 0644'
160+
161+ - name : Install systemd timer for LE renewal
162+ ansible.builtin.template :
163+ src : gitlab-renew-le.timer.j2
164+ dest : /etc/systemd/system/gitlab-renew-le.timer
165+ owner : root
166+ group : root
167+ mode : ' 0644'
168+
169+ - name : Reload systemd daemon
170+ ansible.builtin.command : systemctl daemon-reload
171+ changed_when : true
172+
173+ - name : Enable and start the LE renewal timer
174+ ansible.builtin.systemd :
175+ name : gitlab-renew-le.timer
176+ enabled : true
177+ state : started
178+
141179# @TODO - this task fails in CI with GitHub Actions because PostGreSQL isn't running
142180- name : Run the GitLab configuration script for config that cannot be set in gitlab.rb.
143181 ansible.builtin.command : /opt/gitlab/bin/gitlab-rails runner /etc/gitlab/gitlab-config.rb
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description=Force GitLab LE Cert Renewal at Boot
3+ After=network.target
4+
5+ [Service]
6+ ExecStart=/opt/gitlab/bin/gitlab-ctl renew-le-certs
7+ Type=oneshot
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description=Run GitLab LE Renewal at Boot
3+
4+ [Timer]
5+ OnBootSec=5min
6+ Unit=gitlab-renew-le.service
7+
8+ [Install]
9+ WantedBy=timers.target
You can’t perform that action at this time.
0 commit comments