Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: inventory tracing #44

Merged
merged 3 commits into from
Jan 1, 2025
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
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
55 changes: 37 additions & 18 deletions playbooks/inventory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,42 @@
dest: "/tmp/{{ ansible_hostname }}.json"


- name: Upload inventory - {{ ansible_hostname }}
ansible.builtin.uri:
url: |-
{{ lookup('env', 'ITSM_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 }}"
timeout: 300
status_code:
- 200
- 201
no_log: > # Contains a secret that logging shows
{{ nfc_pb_disable_log | default(true) }}
- name: Try / catch
block:


- 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

Check failure on line 133 in playbooks/inventory.yaml

View workflow job for this annotation

GitHub Actions / Ansible Collection / Lint

syntax-check[specific]

unexpected parameter type in action: <class 'ansible.parsing.yaml.objects.AnsibleSequence'>
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:
Expand All @@ -128,6 +146,7 @@
path: "/tmp/{{ ansible_hostname }}.json"
state: absent


vars:

nfc_pb_awx_tower_template:
Expand Down
Loading