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

fix: use changed_when on shell and command tasks #118

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
become: yes
ansible.builtin.shell:
cmd: gitlab-ctl reconfigure || (touch /etc/gitlab/reconfigure_failed && /bin/false)
register: gitlab_reconfigure
changed_when: true
environment:
SKIP_POST_DEPLOYMENT_MIGRATIONS: true
listen: GitLab has been installed or upgraded
Expand All @@ -24,24 +24,27 @@
become: yes
ansible.builtin.shell:
cmd: gitlab-ctl reconfigure || (touch /etc/gitlab/reconfigure_failed && /bin/false)
register: gitlab_reconfigure
changed_when: true
listen: GitLab has been installed or upgraded
when: not gitlab_is_primary

- name: Restart GitLab
become: yes
ansible.builtin.command: gitlab-ctl restart
changed_when: true
register: gitlab_restart

- name: Send SIGHUP to puma worker
become: yes
ansible.builtin.command: gitlab-ctl hup puma
changed_when: true
listen: GitLab has been installed or upgraded
when: not gitlab_mattermost_only_context

- name: Restart sidekiq
become: yes
ansible.builtin.command: gitlab-ctl restart sidekiq
changed_when: true
listen: GitLab has been installed or upgraded
when: not gitlab_mattermost_only_context

Expand Down
1 change: 1 addition & 0 deletions tasks/feature-flag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- name: "Enable or disable feature flag {{ gitlab_feature_flag.name }}"
ansible.builtin.command:
cmd: "gitlab-rails runner 'Feature.{{ 'enable' if gitlab_feature_flag.enabled else 'disable' }}(:{{ gitlab_feature_flag.name }})'"
changed_when: true
when: "(is_feature_enabled.stdout == 'true' and not gitlab_feature_flag.enabled) or (is_feature_enabled.stdout == 'false' and gitlab_feature_flag.enabled)"

...
2 changes: 2 additions & 0 deletions tasks/reconfigure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- name: Reconfigure Primary GitLab
become: yes
ansible.builtin.command: gitlab-ctl reconfigure
changed_when: true
environment:
SKIP_POST_DEPLOYMENT_MIGRATIONS: "true"
when:
Expand All @@ -17,6 +18,7 @@
- name: Reconfigure Non Primary GitLab
become: yes
ansible.builtin.command: gitlab-ctl reconfigure
changed_when: true
when:
- not gitlab_is_primary
- gitlab_ctl.stat.exists
Expand Down