fix(pulumi/examples): use handlers

This commit is contained in:
Michele Cereda
2024-04-28 22:48:21 +02:00
parent 38e5d9803f
commit 51aed44844
5 changed files with 33 additions and 37 deletions

View File

@@ -1,6 +1,4 @@
ansible/playbooks/aws.ec2.enable-ssm-agent.yml package-latest
ansible/playbooks/keybase.register-device.yml no-changed-when
examples/ansible/aws_ec2.yml yaml[comments-indentation]
examples/pulumi/gitlab-omnibus-on-aws-ec2/ansible-playbook.yml package-latest
examples/pulumi/gitlab-omnibus-on-aws-ec2/ansible-role-gitlab-omnibus-on-ec2/tasks/configure/omnibus.yml no-handler
examples/pulumi/gitlab-omnibus-on-aws-ec2/ansible-role-gitlab-omnibus-on-ec2/tasks/pre-flight.yml name[template]
ansible/playbooks/aws.ec2.enable-ssm-agent.yml package-latest
ansible/playbooks/keybase.register-device.yml no-changed-when
examples/ansible/aws_ec2.yml yaml[comments-indentation]
examples/pulumi/gitlab-omnibus-on-aws-ec2/ansible-playbook.yml package-latest

View File

@@ -0,0 +1,24 @@
---
- name: "Validate Gitlab's configuration file"
become: true
ansible.builtin.command: >-
gitlab-ctl show-config
register: config_file_validation
changed_when: false
failed_when: config_file_validation.rc != 0
- name: Reconfigure Gitlab
when: config_file_validation is not failed
become: true
ansible.builtin.command: >-
gitlab-ctl reconfigure
register: reconfiguration
changed_when:
- reconfiguration.rc == 0
- >-
(
reconfiguration.stdout
| regex_findall('Infra Phase complete, .*')
) is not search('0/')
failed_when: reconfiguration.rc != 0

View File

@@ -10,32 +10,6 @@
mode: u=rw,g=,o=
backup: true
register: config_file
- name: Validate the configuration file
# Since it cannot be validated by the 'template' module as it requires a file name to be specified.
when: config_file is changed
become: true
ansible.builtin.command: >-
gitlab-ctl show-config
register: config_file_validation
changed_when: false
failed_when: config_file_validation.rc != 0
- name: Reconfigure Gitlab
when:
- config_file is changed
- config_file_validation is not failed
become: true
ansible.builtin.command: >-
gitlab-ctl reconfigure
register: reconfiguration
changed_when:
- reconfiguration.rc == 0
- >-
{{
(
reconfiguration.stdout
| regex_findall('Infra Phase complete, .*')
) is not search('0/')
}}
failed_when: reconfiguration.rc != 0
notify:
- "Validate Gitlab's configuration file"
- Reconfigure Gitlab

View File

@@ -58,7 +58,7 @@
register: initial_password_file_stat
- name: Recover the auto-generated administrator's initial password
block:
- name: Read the initial password file
- name: Recover the password from the initial password file
when: initial_password_file_stat.stat.exists
block:
- name: Read the initial password file

View File

@@ -38,7 +38,7 @@
- never
ansible.builtin.debug:
msg: "{{ query('community.dns.lookup', external_url_hostname) }}"
- name: Check an A or AAAA DNS record for '{{ external_url_hostname }}' exist
- name: Check an A or AAAA DNS record already exists for '{{ external_url_hostname }}'
ansible.builtin.assert:
that: >-
query('community.dns.lookup', external_url_hostname) != [] or