Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 23c971b

Browse files
Merge pull request #118 from Normo/fix-ansible-lint
fix: use changed_when on shell and command tasks
2 parents f31eda2 + d955c42 commit 23c971b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

handlers/main.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
become: yes
1515
ansible.builtin.shell:
1616
cmd: gitlab-ctl reconfigure || (touch /etc/gitlab/reconfigure_failed && /bin/false)
17-
register: gitlab_reconfigure
17+
changed_when: true
1818
environment:
1919
SKIP_POST_DEPLOYMENT_MIGRATIONS: true
2020
listen: GitLab has been installed or upgraded
@@ -24,24 +24,27 @@
2424
become: yes
2525
ansible.builtin.shell:
2626
cmd: gitlab-ctl reconfigure || (touch /etc/gitlab/reconfigure_failed && /bin/false)
27-
register: gitlab_reconfigure
27+
changed_when: true
2828
listen: GitLab has been installed or upgraded
2929
when: not gitlab_is_primary
3030

3131
- name: Restart GitLab
3232
become: yes
3333
ansible.builtin.command: gitlab-ctl restart
34+
changed_when: true
3435
register: gitlab_restart
3536

3637
- name: Send SIGHUP to puma worker
3738
become: yes
3839
ansible.builtin.command: gitlab-ctl hup puma
40+
changed_when: true
3941
listen: GitLab has been installed or upgraded
4042
when: not gitlab_mattermost_only_context
4143

4244
- name: Restart sidekiq
4345
become: yes
4446
ansible.builtin.command: gitlab-ctl restart sidekiq
47+
changed_when: true
4548
listen: GitLab has been installed or upgraded
4649
when: not gitlab_mattermost_only_context
4750

tasks/feature-flag.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- name: "Enable or disable feature flag {{ gitlab_feature_flag.name }}"
1515
ansible.builtin.command:
1616
cmd: "gitlab-rails runner 'Feature.{{ 'enable' if gitlab_feature_flag.enabled else 'disable' }}(:{{ gitlab_feature_flag.name }})'"
17+
changed_when: true
1718
when: "(is_feature_enabled.stdout == 'true' and not gitlab_feature_flag.enabled) or (is_feature_enabled.stdout == 'false' and gitlab_feature_flag.enabled)"
1819

1920
...

tasks/reconfigure.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- name: Reconfigure Primary GitLab
99
become: yes
1010
ansible.builtin.command: gitlab-ctl reconfigure
11+
changed_when: true
1112
environment:
1213
SKIP_POST_DEPLOYMENT_MIGRATIONS: "true"
1314
when:
@@ -17,6 +18,7 @@
1718
- name: Reconfigure Non Primary GitLab
1819
become: yes
1920
ansible.builtin.command: gitlab-ctl reconfigure
21+
changed_when: true
2022
when:
2123
- not gitlab_is_primary
2224
- gitlab_ctl.stat.exists

0 commit comments

Comments
 (0)