From 57a36103ca9067ab6273dd95e3ba42e5151b9e07 Mon Sep 17 00:00:00 2001 From: "jason.page" Date: Wed, 21 Aug 2024 16:05:15 +0930 Subject: [PATCH 1/3] fix(teams): replace PATCH -> POST POST is required to overwrite Updated docs to reflect changes #30 closes #29 --- .../ansible/collection/centurion/playbooks/teams.md | 6 +++--- playbooks/teams.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/projects/ansible/collection/centurion/playbooks/teams.md b/docs/projects/ansible/collection/centurion/playbooks/teams.md index bbc492c..855a2bf 100644 --- a/docs/projects/ansible/collection/centurion/playbooks/teams.md +++ b/docs/projects/ansible/collection/centurion/playbooks/teams.md @@ -21,14 +21,14 @@ The following job template will be created: ## Play workflow -The teams playbook gathers information regarding centurion organisations from the ansible inventory. Using this information the play is designed to create new teams, patch permissions and patch notes. The workflow for the playbook is as follows +The teams playbook gathers information regarding centurion organisations from the ansible inventory. Using this information the play is designed to create new teams with permissions and notes. The workflow for the playbook is as follows - Fetch all organisations from Centurion ERP - Fetch all existing teams within each organisation from Centurion ERP - Fetch any teams to be created from inventory - Create new teams -- Patch all teams with required permissions -- Patch all teams with required notes +- POST all teams with required permissions +- POST all teams with required notes ## Configuration diff --git a/playbooks/teams.yaml b/playbooks/teams.yaml index d0a652a..9113a60 100644 --- a/playbooks/teams.yaml +++ b/playbooks/teams.yaml @@ -198,11 +198,11 @@ {{ nfc_pb_disable_log | default(true) }} - - name: Patch team permissions + - name: Replace team permissions ansible.builtin.uri: url: |- {{ item.url }}permissions - method: PATCH + method: POST body_format: json body: "{{ item.permissions }}" headers: @@ -219,11 +219,11 @@ {{ nfc_pb_disable_log | default(true) }} - - name: Patch team notes + - name: replace team notes ansible.builtin.uri: url: |- {{ item.url }} - method: PATCH + method: POST body_format: json body: |- { From fc504d98297cb71084e87e421bb0124c4ac2eeee Mon Sep 17 00:00:00 2001 From: "jason.page" Date: Fri, 23 Aug 2024 10:11:48 +0930 Subject: [PATCH 2/3] fix(teams_playbook): Delete ansible.cfg Required to be removed to run playbook on AWX ref: #30 --- ansible.cfg | 5 ----- playbooks/teams.yaml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 ansible.cfg diff --git a/ansible.cfg b/ansible.cfg deleted file mode 100644 index 912861c..0000000 --- a/ansible.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[defaults] -collections_path= ~/git/ansible_collections - -[inventory] -enable_plugins = nofusscomputing.centurion.centurion diff --git a/playbooks/teams.yaml b/playbooks/teams.yaml index 9113a60..367dfc8 100644 --- a/playbooks/teams.yaml +++ b/playbooks/teams.yaml @@ -223,7 +223,7 @@ ansible.builtin.uri: url: |- {{ item.url }} - method: POST + method: PATCH body_format: json body: |- { From 9c33f5e6ddb8726f06f869cac299dc7b0c170005 Mon Sep 17 00:00:00 2001 From: "jason.page" Date: Fri, 23 Aug 2024 12:21:58 +0930 Subject: [PATCH 3/3] chore(playbook_teams): Capitalise task name Ref: #30 --- .../collection/centurion/playbooks/inventory.md | 3 +++ .../ansible/collection/centurion/playbooks/teams.md | 11 +++++++++-- playbooks/teams.yaml | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/projects/ansible/collection/centurion/playbooks/inventory.md b/docs/projects/ansible/collection/centurion/playbooks/inventory.md index 7c61f77..2571560 100644 --- a/docs/projects/ansible/collection/centurion/playbooks/inventory.md +++ b/docs/projects/ansible/collection/centurion/playbooks/inventory.md @@ -27,7 +27,10 @@ On import to AWX / Ansible Automation Platform a credential type will also be cr The inventory playbook conducts the follwoing tasks: - Gathers host information + - Gathers sofware information + - Uploads the inventory report to Centurion ERP + - Cleans any leftover files used to create the reports diff --git a/docs/projects/ansible/collection/centurion/playbooks/teams.md b/docs/projects/ansible/collection/centurion/playbooks/teams.md index 855a2bf..8bd0df1 100644 --- a/docs/projects/ansible/collection/centurion/playbooks/teams.md +++ b/docs/projects/ansible/collection/centurion/playbooks/teams.md @@ -24,11 +24,18 @@ The following job template will be created: The teams playbook gathers information regarding centurion organisations from the ansible inventory. Using this information the play is designed to create new teams with permissions and notes. The workflow for the playbook is as follows - Fetch all organisations from Centurion ERP + - Fetch all existing teams within each organisation from Centurion ERP + - Fetch any teams to be created from inventory + - Create new teams -- POST all teams with required permissions -- POST all teams with required notes + +- for each team + + - Replace the team permissions + + - Replace the contents of the notes field ## Configuration diff --git a/playbooks/teams.yaml b/playbooks/teams.yaml index 367dfc8..494268e 100644 --- a/playbooks/teams.yaml +++ b/playbooks/teams.yaml @@ -219,7 +219,7 @@ {{ nfc_pb_disable_log | default(true) }} - - name: replace team notes + - name: Replace team notes ansible.builtin.uri: url: |- {{ item.url }}