Skip to content

Commit 26386f4

Browse files
committed
gitlab: Update molecule tests to catch missing become directives
Signed-off-by: Norman Ziegner <[email protected]>
1 parent 39b0543 commit 26386f4

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

molecule/gitlab/converge.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
---
77
- name: "Converge"
88
hosts: "all"
9+
become: false
910
tasks:
1011
- name: "Include gitlab role"
1112
ansible.builtin.include_role:

molecule/gitlab/molecule.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ platforms:
1313
image: "${MOLECULE_IMAGE:-ghcr.io/hifis-net/ubuntu-systemd:24.04}"
1414
pre_build_image: true
1515
privileged: true
16-
systemd: "always"
16+
systemd: true
1717
tty: true
1818
override_command: false
1919
provisioner:
@@ -29,6 +29,7 @@ provisioner:
2929
inventory:
3030
host_vars:
3131
instancegitlab:
32+
ansible_user: "ansible"
3233
gitlab_edition: "gitlab-ce"
3334
gitlab_ip_range: "0.0.0.0/0"
3435
gitlab_additional_configurations:

molecule/gitlab/prepare.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- "ansible_facts.distribution_major_version | int >= 7"
1414
block:
1515
- name: "Install missing dependencies"
16+
become: true
1617
ansible.builtin.dnf:
1718
name:
1819
- "sudo"
@@ -21,24 +22,11 @@
2122
state: "present"
2223
update_cache: true
2324

24-
# Workaround to prevent "sudo: PAM account management error" because of non-readable shadows file on AlmaLinux
25-
- name: "Get file stats for /etc/shadow"
26-
ansible.builtin.stat:
27-
path: "/etc/shadow"
28-
register: "shadow"
29-
30-
- name: "Fix permissions for /etc/shadow"
31-
ansible.builtin.file:
32-
path: "/etc/shadow"
33-
owner: "root"
34-
group: "{{ shadow.stat.gr_name }}"
35-
mode: "0640"
36-
when: "not shadow.stat.rusr"
37-
3825
- name: "Install depenencies for OS family Debian"
3926
when: "ansible_facts.os_family == 'Debian'"
4027
block:
4128
- name: "Install missing dependencies"
29+
become: true
4230
ansible.builtin.apt:
4331
name:
4432
- "sudo" # for `become` privilege escalation

molecule/gitlab/verify.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@
5454
failed_when: "liveness_check.status == 503"
5555

5656
- name: "Check the output of gitlab status"
57+
become: true
5758
ansible.builtin.command: "gitlab-ctl status"
5859
register: "gitlab_ctl_status"
5960
changed_when: "gitlab_ctl_status.rc != 0"
6061
failed_when: "gitlab_ctl_status.rc != 0"
6162

6263
- name: "Check GitLab configuration via Rake task"
64+
become: true
6365
ansible.builtin.command: "gitlab-rake gitlab:check"
6466
register: "gitlab_rake_check"
6567
changed_when: "gitlab_rake_check.rc != 0"

0 commit comments

Comments
 (0)