From 3ce7e5b47a8403ee9e4b9379117fded6b97ed837 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 31 Dec 2024 17:58:11 +0930 Subject: [PATCH 1/3] fix(playbook): Correct Centurion ENV Vars ref: #34 #44 --- playbooks/inventory.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/inventory.yaml b/playbooks/inventory.yaml index c5e0916..14ce162 100644 --- a/playbooks/inventory.yaml +++ b/playbooks/inventory.yaml @@ -105,15 +105,15 @@ - name: Upload inventory - {{ ansible_hostname }} ansible.builtin.uri: url: |- - {{ lookup('env', 'ITSM_API') }}/api/v2/itam/inventory + {{ lookup('env', 'CENTURION_API') }}/api/v2/itam/inventory method: POST body_format: json src: "/tmp/{{ ansible_hostname }}.json" remote_src: true headers: - Authorization: Token {{ lookup('env', 'ITSM_TOKEN') }} - validate_certs: "{{ lookup('env', 'ITSM_VALIDATE_CERTS') | default(true) | bool }}" + Authorization: Token {{ lookup('env', 'CENTURION_TOKEN') }} + validate_certs: "{{ lookup('env', 'CENTURION_VALIDATE_CERTS') | default(true) | bool }}" timeout: 300 status_code: - 200 From 4a34b0f6ca3636f8c112602542d038542b1b0435 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 1 Jan 2025 15:35:35 +0930 Subject: [PATCH 2/3] feat(playbook): Add Trace output for inventory upload ref: #44 closes #34 --- playbooks/inventory.yaml | 53 +++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/playbooks/inventory.yaml b/playbooks/inventory.yaml index 14ce162..ad59a58 100644 --- a/playbooks/inventory.yaml +++ b/playbooks/inventory.yaml @@ -102,24 +102,42 @@ dest: "/tmp/{{ ansible_hostname }}.json" - - name: Upload inventory - {{ ansible_hostname }} - ansible.builtin.uri: - url: |- - {{ lookup('env', 'CENTURION_API') }}/api/v2/itam/inventory + - name: Try / catch + block: - method: POST - body_format: json - src: "/tmp/{{ ansible_hostname }}.json" - remote_src: true - headers: - Authorization: Token {{ lookup('env', 'CENTURION_TOKEN') }} - validate_certs: "{{ lookup('env', 'CENTURION_VALIDATE_CERTS') | default(true) | bool }}" - timeout: 300 - status_code: - - 200 - - 201 - no_log: > # Contains a secret that logging shows - {{ nfc_pb_disable_log | default(true) }} + + - name: Upload inventory - {{ ansible_hostname }} + ansible.builtin.uri: + url: |- + {{ lookup('env', 'CENTURION_API') }}/api/v2/itam/inventory + + method: POST + body_format: json + src: "/tmp/{{ ansible_hostname }}.json" + remote_src: true + headers: + Authorization: Token {{ lookup('env', 'CENTURION_TOKEN') }} + validate_certs: "{{ lookup('env', 'CENTURION_VALIDATE_CERTS') | default(true) | bool }}" + timeout: 300 + status_code: + - 200 + - 201 + no_log: > # Contains a secret that logging shows + {{ nfc_pb_disable_log | default(true) }} + register: api_post_inventory + + + always: + + + - name: Trace - Show Upload Details + ansible.builtin.debug: + - | + Upload failed with: + * URL: {{ api_post_inventory.url }} + * HTTP status code: {{ api_post_inventory.status }} + * Message: {{ api_post_inventory.msg }} + * Body: {{ api_post_inventory.json }} always: @@ -128,6 +146,7 @@ path: "/tmp/{{ ansible_hostname }}.json" state: absent + vars: nfc_pb_awx_tower_template: From 14541064178a939e727195734d5e4548bc0b7b7e Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 1 Jan 2025 15:41:21 +0930 Subject: [PATCH 3/3] docs: update contributing guide ref: #44 closes #36 --- CONTRIBUTING.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88c0ef6..d27431a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,26 @@ # Contribution Guide +First and foremost, thank you for your contribution. If at any stage you are stuck, confused or any other developer prone state, please ask for help. + + +## Requirements + +- Commit Messages use [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) format +- **ALL** CI jobs must pass. if they error, you can view the "details" for what went wrong. + +- Ansible: + + - Tasks must be named + - Task name must reflect their activity + - All task modules to use FQCN + - Don't be afraid of white space. + - Two blanks lines above tasks + - Two blank lines blow tasks + - One blank line at the end of the file + - Any task that "spills" a secret, must use `no_log` + + +## Dev Env Development of this project has been setup to be done from VSCodium. The following additional requirements need to be met: - npm has been installed. _required for `markdown` linting_