77 Commits

Author SHA1 Message Date
82ca88f319 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!24
2025-02-26 13:10:03 +00:00
cd81c24d28 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "6f8dfcba0b25313b59bc17b4c99d674fcedd207a)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "224ef831571458ad433a0143eec00df0f7e8b409)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 224ef831571458ad433a0143eec00df0f7e8b409

MR !24
2025-02-26 13:08:52 +00:00
768bc5ce96 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!22
2024-08-19 07:25:26 +00:00
681b30fa50 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "58ffcabbfb503af3e57d9cb3ab43931b23dc4cd8)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "6f8dfcba0b25313b59bc17b4c99d674fcedd207a)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 6f8dfcba0b25313b59bc17b4c99d674fcedd207a

MR !22
2024-08-19 07:24:42 +00:00
966ac44b11 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!21
2024-08-01 06:09:02 +00:00
55b835ab6f chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "673441f83a7d943434252ee23899e3572cdfb141)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "58ffcabbfb503af3e57d9cb3ab43931b23dc4cd8)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 58ffcabbfb503af3e57d9cb3ab43931b23dc4cd8

MR !21
2024-08-01 06:08:20 +00:00
7b0b9eabea Merge branch 'automated-tasks' into 'development'
chore(website-template): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!20
2024-06-30 18:04:19 +00:00
e5b0ff1388 chore(git): updated submodule website-template
Automation Data:
{
    "branch": "development",
    "current_commit": "92c4b16a14524e7b5b18171d4e21b72676c36fbf)",
    "name": "website-template",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/website-template",
    "remote_head": "8735f623dc5e1d9c9e46e50db03b4c41cb3d1efd)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/infrastructure/website-template.git"
}

Changes: Submodule path website-template: checked out 8735f623dc5e1d9c9e46e50db03b4c41cb3d1efd

MR !20
2024-06-30 18:03:32 +00:00
4e82303909 Merge branch 'automated-tasks' into 'development'
chore(website-template): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!19
2024-06-30 17:48:53 +00:00
2aea5f015e chore(git): updated submodule website-template
Automation Data:
{
    "branch": "development",
    "current_commit": "f5a82d3604faca56756eec91acee28ff89defd1d)",
    "name": "website-template",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/website-template",
    "remote_head": "92c4b16a14524e7b5b18171d4e21b72676c36fbf)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/infrastructure/website-template.git"
}

Changes: Submodule path website-template: checked out 92c4b16a14524e7b5b18171d4e21b72676c36fbf

MR !19
2024-06-30 17:48:07 +00:00
bb79773a36 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!18
2024-06-30 17:44:34 +00:00
6b2568825d chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "a24f352ca3d82b8d0f02f5db20173fe2c3f71a4a)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "673441f83a7d943434252ee23899e3572cdfb141)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 673441f83a7d943434252ee23899e3572cdfb141

MR !18
2024-06-30 17:43:52 +00:00
bfe8b45211 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!17
2024-03-16 11:35:34 +00:00
d13c09b7c9 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "9afa68d1f3849e491fa8ca034749388808531b74)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "a24f352ca3d82b8d0f02f5db20173fe2c3f71a4a)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out a24f352ca3d82b8d0f02f5db20173fe2c3f71a4a

MR !17
2024-03-16 11:34:52 +00:00
3f0e7157f8 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!16
2024-03-14 12:47:10 +00:00
ff910a2bd0 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "41eeb7badd582175b371cd4a5b2192decbcb0210)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "9afa68d1f3849e491fa8ca034749388808531b74)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 9afa68d1f3849e491fa8ca034749388808531b74

MR !16
2024-03-14 12:46:24 +00:00
3022824de7 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!15
2024-02-25 09:32:29 +00:00
fd63f12453 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "6f80ea3af7fdc64e9998820a8800c288d7facbc6)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "41eeb7badd582175b371cd4a5b2192decbcb0210)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 41eeb7badd582175b371cd4a5b2192decbcb0210

MR !15
2024-02-25 09:31:51 +00:00
5d7edd8624 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!14
2024-02-24 06:31:21 +00:00
f6706070cd chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "4f65bc1367585146490637dfc7c57c987216e652)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "6f80ea3af7fdc64e9998820a8800c288d7facbc6)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 6f80ea3af7fdc64e9998820a8800c288d7facbc6

MR !14
2024-02-24 06:30:26 +00:00
fd83ce44fd Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!13
2024-02-23 09:07:41 +00:00
d21d08c9c3 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "8094694d43449f1d17b763e215485b2950e6b6b4)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "4f65bc1367585146490637dfc7c57c987216e652)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 4f65bc1367585146490637dfc7c57c987216e652

MR !13
2024-02-23 09:06:57 +00:00
30afb252dd Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!12
2024-02-23 02:52:08 +00:00
2a8083afc1 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "34c81c98494b5ce448f4da4e645952439c897906)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "8094694d43449f1d17b763e215485b2950e6b6b4)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 8094694d43449f1d17b763e215485b2950e6b6b4

MR !12
2024-02-23 02:51:23 +00:00
04b5892e72 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!11
2024-02-22 09:54:09 +00:00
08ae2c22b4 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "c7c966bbee4fefc044d4c58e60dd5f10ec63862b)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "34c81c98494b5ce448f4da4e645952439c897906)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 34c81c98494b5ce448f4da4e645952439c897906

MR !11
2024-02-22 09:53:24 +00:00
b6c6575f43 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!10
2024-02-22 08:35:17 +00:00
655c2ee45a chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "74ac15925c75ba0178ae21932b02b6a90a9169c3)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "c7c966bbee4fefc044d4c58e60dd5f10ec63862b)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out c7c966bbee4fefc044d4c58e60dd5f10ec63862b

MR !10
2024-02-22 08:34:38 +00:00
186044556e Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!9
2024-02-22 08:05:00 +00:00
534ff0c97e chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "e046f9ea49a617ce91ff2eda53b897f798dfb810)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "74ac15925c75ba0178ae21932b02b6a90a9169c3)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 74ac15925c75ba0178ae21932b02b6a90a9169c3

MR !9
2024-02-22 08:04:17 +00:00
c85f30dd2d Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!8
2024-02-22 06:31:20 +00:00
356077a9bd chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "d29064f1490073599518b629c7bf6585b48c8736)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "e046f9ea49a617ce91ff2eda53b897f798dfb810)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out e046f9ea49a617ce91ff2eda53b897f798dfb810

MR !8
2024-02-22 06:30:38 +00:00
78fb1a8594 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!7
2024-02-17 04:50:20 +00:00
f8bf639012 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "02252db664a428e83fb9ae24662b56b53e615989)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "d29064f1490073599518b629c7bf6585b48c8736)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out d29064f1490073599518b629c7bf6585b48c8736

MR !7
2024-02-17 04:49:41 +00:00
6f0a90345f Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!6
2024-02-15 13:49:05 +00:00
a17c7abc48 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "bea398200f838736c6111a399478667df37435cb)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "02252db664a428e83fb9ae24662b56b53e615989)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out 02252db664a428e83fb9ae24662b56b53e615989

MR !6
2024-02-15 13:48:21 +00:00
9178181771 Merge branch 'automated-tasks' into 'development'
chore(website-template): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!5
2024-02-08 05:32:49 +00:00
583926bd9a chore(git): updated submodule website-template
Automation Data:
{
    "branch": "development",
    "current_commit": "2bcc17652babd4027e7245c6367841e2580ec317)",
    "name": "website-template",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/website-template",
    "remote_head": "f5a82d3604faca56756eec91acee28ff89defd1d)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/infrastructure/website-template.git"
}

Changes: Submodule path website-template: checked out f5a82d3604faca56756eec91acee28ff89defd1d

MR !5
2024-02-08 05:32:06 +00:00
214bca1ea3 Merge branch 'automated-tasks' into 'development'
chore(website-template): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!4
2024-02-02 13:12:15 +00:00
28cd1761e1 chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "e1a7f60401847a60a3302cd7770b03a72d0439c2)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "bea398200f838736c6111a399478667df37435cb)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out bea398200f838736c6111a399478667df37435cb

MR !4
2024-02-02 13:11:33 +00:00
1e84cea4d2 chore(git): updated submodule website-template
Automation Data:
{
    "branch": "development",
    "current_commit": "f5cbde1f1de7cac9094df8898e3d09eb01d9cd4c)",
    "name": "website-template",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/website-template",
    "remote_head": "2bcc17652babd4027e7245c6367841e2580ec317)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/infrastructure/website-template.git"
}

Changes: Submodule path website-template: checked out 2bcc17652babd4027e7245c6367841e2580ec317

MR !4
2024-02-02 13:11:27 +00:00
74c8d926e8 Merge branch 'automated-tasks' into 'development'
chore(gitlab-ci): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!3
2024-02-02 12:34:21 +00:00
f8feaeab5e chore(git): updated submodule gitlab-ci
Automation Data:
{
    "branch": "development",
    "current_commit": "975de7aca210667d1e93d02a4036ca4ae70808ff)",
    "name": "gitlab-ci",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/gitlab-ci",
    "remote_head": "e1a7f60401847a60a3302cd7770b03a72d0439c2)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/projects/gitlab-ci.git"
}

Changes: Submodule path gitlab-ci: checked out e1a7f60401847a60a3302cd7770b03a72d0439c2

MR !3
2024-02-02 12:33:38 +00:00
81de2dc15b Merge branch 'automated-tasks' into 'development'
chore(website-template): Automated update of git sub-module

See merge request nofusscomputing/projects/ansible/nfc_glpi!2
2024-02-02 12:25:24 +00:00
bdd178503e chore(git): updated submodule website-template
Automation Data:
{
    "branch": "development",
    "current_commit": "992b54805b8b6c78a3d2a5ea7de71c7be2b070c8)",
    "name": "website-template",
    "path": "/builds/nofusscomputing/projects/ansible/nfc_glpi/_automation_/website-template",
    "remote_head": "f5cbde1f1de7cac9094df8898e3d09eb01d9cd4c)",
    "remote_name": "origin",
    "url": "https://gitlab.com/nofusscomputing/infrastructure/website-template.git"
}

Changes: Submodule path website-template: checked out f5cbde1f1de7cac9094df8898e3d09eb01d9cd4c

MR !2
2024-02-02 12:24:41 +00:00
71aaa0f1a7 build(version): bump version 0.0.1 → 0.1.0rc0 2023-11-06 08:23:31 +00:00
Jon
63c833299d Merge branch 'genesis' into 'development'
feat: new role

See merge request nofusscomputing/projects/ansible/nfc_glpi!1
2023-11-06 08:21:17 +00:00
Jon
33c882f005 feat(http_cert_validation): new option specify cert validation, default true
!1
2023-08-05 10:27:04 +09:30
Jon
7c82e3a18d feat(url): specify url seperate from protocol, defaults to httpt
!1
2023-08-05 10:25:14 +09:30
Jon
d2d4826247 fix(find_id): remove empty id from dict
!1
2023-07-31 17:44:16 +09:30
Jon
b50a3e9156 fix(api_search): set var tickettemplates_id for ticket template item
!1
2023-07-30 13:12:06 +09:30
Jon
d637f915c5 refactor(api_config): iterate over results
changed to iterate over results as the api search is not exact, it's
contains. now workflow iterates over results and on name match, exact;
Adds the item id.

!1
2023-07-30 12:59:52 +09:30
Jon
00ecd6e0e3 fix(api_config): typo in Add/Update GLPI Config
!1
2023-07-30 12:58:25 +09:30
Jon
93f069c1b3 fix(api_search): typo in tickettemplates_id_demand
!1
2023-07-30 12:57:55 +09:30
Jon
23569ee76a docs(issue_1): add note about exporting
!1
2023-07-30 11:47:31 +09:30
Jon
9a820cd1a0 feat(api): search for groups_id by name
!1
2023-07-30 11:36:12 +09:30
Jon
6d7c169bc8 refactor(api_config): move all search by name to own tasks file
!1
2023-07-30 11:35:08 +09:30
Jon
b0ce3b0022 refactor(api_config): dont log data manipulation
!1
2023-07-30 11:31:20 +09:30
Jon
40e6299741 feat(config): Add Ticket Template Config from code
!1
2023-07-29 21:34:23 +09:30
Jon
baf086de64 feat(api_config): force an empty list if not config
!1
2023-07-29 12:48:24 +09:30
Jon
910663eb19 feat(api_config): exlude instance_uuid item from configuration
!1
2023-07-29 12:10:06 +09:30
Jon
d2902b9ab0 refactor(api_config): updated flow and docs
!1
2023-07-29 12:03:40 +09:30
Jon
4407e57fdd feat(config): Add General Settings Config from code
!1
2023-07-28 18:48:42 +09:30
Jon
b91acddf16 docs(fix): wasnt rendering correctly
!1
2023-07-28 15:36:05 +09:30
Jon
024d6c6d6e ci(pages): added pages environment path
!1
2023-07-28 15:24:06 +09:30
Jon
70a48341a4 feat(config): Configure GLPI from json config files
!1
2023-07-28 15:22:54 +09:30
Jon
febce3aa5e feat(api): Create and end a session
!1
2023-07-28 15:15:33 +09:30
Jon
15573f03cd feat(api): end a session
!1
2023-07-28 15:11:02 +09:30
Jon
e8a5edda5c feat(api): fetch session id
!1
2023-07-28 15:10:47 +09:30
Jon
e1d6dba5ef feat(api): search for users_id by name
!1
2023-07-28 15:09:28 +09:30
Jon
a0103570f5 feat(api): search for itilcategory_id by name
!1
2023-07-28 15:09:11 +09:30
Jon
825aade159 feat(api): search for tickettemplates_id_demand by name
!1
2023-07-28 15:08:48 +09:30
Jon
4624f5c80d feat(api): search for item_id by name
!1
2023-07-28 15:08:22 +09:30
Jon
741107e0b2 feat(api): search for entities_id by name
!1
2023-07-28 15:08:10 +09:30
Jon
1c78ec036c feat(docs): added docs
!1
2023-07-28 14:49:36 +09:30
Jon
62081982e8 feat(ci): added ci repo
!1
2023-07-27 13:36:11 +09:30
Jon
d1813b9391 feat(migration): initial adding of role to repo
!1
2023-07-27 13:32:30 +09:30
39 changed files with 1641 additions and 0 deletions

7
.cz.yaml Normal file
View File

@ -0,0 +1,7 @@
commitizen:
bump_message: "build(version): bump version $current_version \u2192 $new_version"
changelog_incremental: false
name: cz_conventional_commits
tag_format: $major.$minor.$patch$prerelease
update_changelog_on_bump: true
version: 0.1.0rc0

15
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,15 @@
---
include:
- project: nofusscomputing/projects/gitlab-ci
ref: development
file:
- .gitlab-ci_common.yaml
- template/automagic.gitlab-ci.yaml
variables:
MY_PROJECT_ID: "48046854"
GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/ansible_role_glpi.git"
PAGES_ENVIRONMENT_PATH: projects/nfc_glpi/

8
.gitmodules vendored Normal file
View File

@ -0,0 +1,8 @@
[submodule "gitlab-ci"]
path = gitlab-ci
url = https://gitlab.com/nofusscomputing/projects/gitlab-ci.git
branch = development
[submodule "website-template"]
path = website-template
url = https://gitlab.com/nofusscomputing/infrastructure/website-template.git
branch = development

8
.nfc_automation.yaml Normal file
View File

@ -0,0 +1,8 @@
---
role_git_conf:
gitlab:
submodule_branch: "development"
default_branch: development
mr_labels: ~"type::automation" ~"impact::0" ~"priority::0"
auto_merge: true

48
CHANGELOG.md Normal file
View File

@ -0,0 +1,48 @@
## 0.1.0rc0 (2023-11-06)
### Bug Fixes
- **find_id**: [d2d48262](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/d2d4826247289debfa4d073baefc15d8048a5436) - remove empty id from dict [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api_search**: [b50a3e91](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/b50a3e9156f3d18dd43fe495c86cca465ccd38c6) - set var tickettemplates_id for ticket template item [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api_config**: [00ecd6e0](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/00ecd6e0e30254c2e87f84b1196d534df576cfd9) - typo in Add/Update GLPI Config [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api_search**: [93f069c1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/93f069c1b39e882e0a1a341c6352de600b68af17) - typo in tickettemplates_id_demand [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
### Code Refactor
- **api_config**: [d637f915](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/d637f915c5de32fdd854b9f72f3c1a6eb5ca1d04) - iterate over results [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api_config**: [6d7c169b](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/6d7c169bc8cfffbcf094469871316282435a35d8) - move all search by name to own tasks file [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api_config**: [b0ce3b00](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/b0ce3b00227c0141e9c9f7cd0b5be40ed7e735ee) - dont log data manipulation [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api_config**: [d2902b9a](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/d2902b9ab055cc0b3e599da1f0f4ecb4d9e7b474) - updated flow and docs [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
### Continious Integration
- **pages**: [024d6c6d](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/024d6c6d6e1f04a2159ff31d3f31e276aa4ad983) - added pages environment path [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
### Documentaton / Guides
- **issue_1**: [23569ee7](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/23569ee76a53fb4ae0c815bc086d5eac374ff455) - add note about exporting [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **fix**: [b91acddf](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/b91acddf16d420ff8fbc0578a3fdb0c771fc3a64) - wasnt rendering correctly [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
### Features
- **http_cert_validation**: [33c882f0](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/33c882f005c26e86bd19e5ed4f2ad11ab7f5b0b6) - new option specify cert validation, default true [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **url**: [7c82e3a1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/7c82e3a18d992db25577a8611fa964ae555469a9) - specify url seperate from protocol, defaults to httpt [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [9a820cd1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/9a820cd1a0db9144bc13b859d8dc25a77c19eee5) - search for groups_id by name [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **config**: [40e62997](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/40e629974128b3788cdfadea37e7aa2caae115de) - Add Ticket Template Config from code [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api_config**: [baf086de](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/baf086de642513657d4f70dbb497f9e755b7e557) - force an empty list if not config [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api_config**: [910663eb](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/910663eb19fcd61bfa9b7419bcb75b3a4d1be62b) - exlude instance_uuid item from configuration [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **config**: [4407e57f](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/4407e57fdd56dc49be7b7b5e3550069b2ab7eca4) - Add General Settings Config from code [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **config**: [70a48341](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/70a48341a4f1ec510626b0db212a6c6d3fd60826) - Configure GLPI from json config files [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [febce3aa](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/febce3aa5e6bb07ca62aae627a1110acc075038a) - Create and end a session [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [15573f03](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/15573f03cdb37aef2cc8c6fa5df2f9fb868041fc) - end a session [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [e8a5edda](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/e8a5edda5cb2a28366f3aba6bd4313e68f593708) - fetch session id [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [e1d6dba5](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/e1d6dba5ef9de34b90992f04ee1ebae1e93b6f43) - search for users_id by name [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [a0103570](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/a0103570f5d8e6cffee374c32fc1a2c279ae1ed4) - search for itilcategory_id by name [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [825aade1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/825aade159aed773161ff8ca946ce25065359026) - search for tickettemplates_id_demand by name [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [4624f5c8](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/4624f5c80d43c76d1b658c4852507b26a2c1a30d) - search for item_id by name [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **api**: [741107e0](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/741107e0b20f63d98e8044254be4fee2abe81204) - search for entities_id by name [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **docs**: [1c78ec03](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/1c78ec036ccaa2a822c419d9b5b8c0f28cb5b131) - added docs [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **ci**: [62081982](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/62081982e83ed1fbbec2e221ddcfc3df2a849258) - added ci repo [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
- **migration**: [d1813b93](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/commit/d1813b939183d85fb24c381ed169fa53bf802151) - initial adding of role to repo [ [!1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/merge_requests/1) ]
## 0.0.1 (2023-07-27)

51
defaults/main.yaml Normal file
View File

@ -0,0 +1,51 @@
---
# directory_logrotate_config: /etc/logrotate.d
install_glpi: 'true'
glpi_installed: false
# logfile_max_size: 10 # must be specified in MB (Mega Bytes)
# logrotate_configuration: [] # Global var for usage within group/host vars
docker_image_name_glpi: nofusscomputing/docker-glpi
docker_image_tag_glpi: dev
docker_container_name_glpi: glpi
# mysql_unix_socket: /run/mysql/mariadb/mysqld.sock
mysql_unix_socket: /var/lib/docker/volumes/socket-mysql/_data/mysqld.sock
mysql_login_user: root
mysql_login_password: admin
glpi_plugins:
- filename: fail2ban_1.0.2-1.upstream1_all.deb
#url: https://github.com/pluginsGLPI/formcreator/releases/download/2.13.6/glpi-formcreator-2.13.6.tar.bz2
url: https://api.github.com/repos/pluginsGLPI/formcreator/releases/tags/2.13.6
- filename: glpi-glpiinventory-1.2.3.tar.bz2
#url: https://github.com/glpi-project/glpi-inventory-plugin/releases/download/1.2.3/glpi-glpiinventory-1.2.3.tar.bz2
url: https://api.github.com/repos/glpi-project/glpi-inventory-plugin/releases/tags/1.2.3
# - filename: glpi-actualtime-2.1.0.tar.tgz
# url: https://api.github.com/repos/ticgal/actualtime/releases/tags/2.1.0/glpi-actualtime-2.1.0.tar.tgz
mysql_database_glpi: glpi
# Configuration Example
# logrotate:
# - name: docker # Mandatory, used as logrotate difinition file name
# path: '/var/lib/docker/containers/*/*.log' # Mandatory, path to the logfile
# su: ingress ingress # Optional,, string user and group for log permissions
# interval: daily # optional example daily, weekly, monthly default=daily
# keep: # Optional, int, How many logs to keep default=7
# size: 10 # Optional, max size of logfile in Mega Bytes. DONT specify unit. default={{}}
# compress: # Optional, bool default=true
# delaycompress: # Optional, bool, delay logfile compression default=true
# postrotate: 'docker restart $(docker ps -q)' # Optional, Command to run post rotate default=not defined
# create: # Optional, default=not defined
# mode: 640 # Mandatory, filemode
# owner: root # Mandatory, logfile owner
# group: adm # Mandatory, logfile group owner
glpi_config_as_code_json: []
search_items: []

0
docs/articles/index.md Normal file
View File

0
docs/contact.md Normal file
View File

0
docs/index.md Normal file
View File

0
docs/operations/index.md Normal file
View File

0
docs/projects/index.md Normal file
View File

View File

@ -0,0 +1,170 @@
---
title: GLPI Config as code
description: How to use No Fuss Computings Ansible role to configure GLPI from configuration as code.
date: 2023-07-28
template: project.html
about: https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi
---
To configure GLPI using this role, the config/settings are saved as json files. The workflow to create the json files, is to (preferably within a test environment) make the required setting changes in GLPI using the GUI. once the changes have been made, conduct an API `GET` query to GLPI for the item you changed. The JSON body that is returned, is placed within the Config file (detailed below) under path `.body`. You must however, remove any fields that are not required, for example dynamic fields (fields that update themselves or are auto created) for example date fields. it's also recommended to remove the items `id` entry from the body, this option enables the updating and creation of the item by the name field.
As the export process is manual to create the json files, it is possible that errors could occur. another side effect is that when updating an item, when checking it into an SCM (git for example), that the commit may contain more than the item that changed. This is planned to be rectified in [gitlab-#1](https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/issues/1).
!!! warning
To utilise the config from json files, it's important that any configurable item from json files, that it's name is unique for that item type within GLPI. This is due to the feature "find item_id by name" i.e. you can't have two items named `my name` and `my name` of type `x`, even if in different entities.
## Config files Example
Each tab provides an example of the JSON file layout, including any additional variables. Variable listed at path `.`, with the exception of `api_path`, `body` or have asuffix of `_` are provided to use that items name. These fields are used to fetch the item_id of the field by name. available fields are:
- entities_id
- groups_id
- item_id
- itilcategories_id
- tickettemplates_id_demand
- tickettemplates_id
- users_id
For example, to have an item placed in the entity `NoFussComputing` provided value would be `"entities_id": "NoFussComputing"`. As part of the item workflow a search for an entity named `NoFussComputing` is conducted, and if found, adds it's `entity_id` to path `.body.entities_id: {entity_id}`.
!!! tip
If you leave the item ID in the config file under path `.body.id`, the item that matches this ID, will be updated, not the item matching the name.
=== "AuthLDAP"
``` json title="example.json" linenums="1"
{
"api_path": "AuthLDAP",
"body": {
// JSON from API Query
}
}
```
=== "Config (GLPI General Settings)"
This config file contains the settings found in `General Settings`. The full API JSON response is added to the body. When this file is processed, each individual item is added via the API without using the `id` as found in the JSON file. This is done as the ID's can change, so the workflow includes a step that matches the config item name to the found id in the database, then patches with the values from the JSON file.
``` json title="example.json" linenums="1"
{
"api_path": "Config",
"body": [
// JSON from API Query the full response (see note below)
]
}
```
!!! info
The structure of this JSON file is different than the rest. The body is a **list** of **ALL** of the Config options. This includes the item ID. it was done this way, so that only one API query is required to export all config options.
!!! info "Further Information"
Any config item that does not contain a value field, is excluded from being added or updated. In addition, the following items by name, are excluded
``` yaml title="tasks/api/excluded_config.yaml" linenums="1"
--8<-- "tasks/api/excluded_config.yaml"
```
=== "Entity"
``` json title="example.json" linenums="1"
{
"api_path": "Entity",
"entities_id": "",
"body": {
// JSON from API Query
}
}
```
=== "ITILCategory"
``` json title="example.json" linenums="1"
{
"api_path": "ITILCategory",
"users_id": "",
"itilcategories_id": "",
"entities_id": "",
"tickettemplates_id_demand": "",
"body": {
// JSON from API Query
}
}
```
=== "Profile"
``` json title="example.json" linenums="1"
{
"api_path": "Profile",
"body": {
// JSON from API Query
}
}
```
=== "TicketTemplate"
This config file covers all parts of a ticket template. with this template you can create and update an existing ticket template.
!!! warning
Assosiated Items do not get updated or removed. They will be added if they don't exist. No checks are done for more assosiated items then are specified in the template.
``` json title="example.json" linenums="1"
{
"api_path": "TicketTemplate",
"entities_id": "",
"body": {
// JSON from API Query
},
"_TicketTemplateMandatoryField": [
// JSON from API Query path TicketTemplate/{ticket_template_id}/TicketTemplateMandatoryField
],
"_TicketTemplatePredefinedField": [
// JSON from API Query path TicketTemplate/{ticket_template_id}/TicketTemplatePredefinedField
],
"_TicketTemplateHiddenField": [
// JSON from API Query path TicketTemplate/{ticket_template_id}/TicketTemplateHiddenField
]
}
```
Sub-items to the ticket are `TicketTemplateMandatoryField`, `TicketTemplatePredefinedField` and `TicketTemplateHiddenField` and are at json path `._{sub-item}`. These items are a **list of dicts** and can contain the `id` of the item, however it is ignored as the update is base off of `tickettemplates_id`, `num` for all and `tickettemplates_id`, `num` and `value` for `num=13` which is an assosiated item. With the exception of the latter, all of these values will be updated if they exist.
With the config files structured as per the examples, within your playbook(s), load the json files in a list of json objects using variable `glpi_config_as_code_json`
example
``` yaml title="my_vars.yaml" linenums="1"
glpi_config_as_code_json:
- "{{ lookup('file', '/workdir/files/glpi/ITILCategory-new-ldap-user.json') | from_json }}"
- "{{ lookup('file', '/workdir/files/glpi/LDAPAuth-local_ldap.json') | from_json }}"
```

View File

@ -0,0 +1,25 @@
---
title: nfc_glpi - Ansible Role
description: How to use No Fuss Computings Ansible role to manage GLPI from configuration as code.
date: 2023-07-28
template: project.html
about: https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi
---
This Ansible role is designed to manage GLPI specifically installation and configuration.
## Features
- install GLPI using our [docker container](https://gitlab.com/nofusscomputing/projects/docker-glpi)
- [Configure using Config from Code](config_from_code.md)
## Default Variables
``` yaml title="defaults/main.yaml" linenums="1"
--8<-- "defaults/main.yaml"
```

1
gitlab-ci Submodule

Submodule gitlab-ci added at 224ef83157

29
handlers/main.yaml Normal file
View File

@ -0,0 +1,29 @@
---
# - name: Log Rotate Configuration files
# ansible.builtin.template:
# src: definition.j2
# dest: "{{ directory_logrotate_config }}/{{ item.name }}"
# owner: root
# mode: '0644'
# force: true
# loop: "{{ logrotate_configuration }}"
# listen: 'configure_logrotate'
# notify: restart_logrotate
# when: logrotate_installed | bool
# - name: Restart logrotate
# ansible.builtin.service:
# name: logrotate
# state: restarted
# listen: restart_logrotate
# when: logrotate_installed | bool
- name: Restart GLPI
community.docker.docker_container:
name: "{{ docker_container_name_glpi }}"
state: started
restart: true
listen: restart_glpi
when: >
glpi_installed | bool

13
meta/main.yaml Normal file
View File

@ -0,0 +1,13 @@
galaxy_info:
role_name: nfc_glpi
author: No Fuss Computing
description: |-
A universal role to install and configure a glpi.
This role is also desiged so that it can be included within other roles.
issue_tracker_url: https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi
license: https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi/-/blob/master/LICENSE
min_ansible_version: '1.2'

33
mkdocs.yml Normal file
View File

@ -0,0 +1,33 @@
INHERIT: website-template/mkdocs.yml
docs_dir: 'docs'
repo_name: nfc_glpi
repo_url: https://gitlab.com/nofusscomputing/projects/ansible/nfc_glpi
edit_uri: '/-/ide/project/nofusscomputing/projects/ansible/nfc_glpi/edit/development/-/docs/'
nav:
- Home: index.md
- Articles:
- articles/index.md
- Projects:
- projects/index.md
- Ansible Roles:
- GLPI:
- projects/nfc_glpi/index.md
- projects/nfc_glpi/config_from_code.md
- Operations:
- operations/index.md
- Contact Us: contact.md

24
tasks/api/api.yaml Normal file
View File

@ -0,0 +1,24 @@
---
- name: Always End Session
block:
- name: Start Session
ansible.builtin.include_tasks:
file: api/session-create.yaml
when: glpi.api.session | default('') == ''
- name: Append/Create Item
ansible.builtin.include_tasks:
file: search-add.yaml
loop: "{{ glpi_config_as_code_json }}"
always:
- name: End Session
ansible.builtin.include_tasks:
file: api/session-end.yaml
when: glpi_session_get.status | default(0) | int == 200

View File

@ -0,0 +1,73 @@
---
- name: Show item
ansible.builtin.debug:
msg: "{{ item }}"
- name: Create item_body
ansible.builtin.set_fact:
item_body: "{{ item.body }}"
no_log: true
- name: Search for item IDs
ansible.builtin.include_tasks:
file: api/search.yaml
- name: Show Body
ansible.builtin.debug:
msg: "{{ item_body }}"
when: item_body is defined
- name: Create Item
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/{{ item.api_path }}{% if item.sub_path is defined %}/{{ item.sub_path }}{% endif %}"
method: "POST"
return_content: true
body: "{\"input\": {{ item_body | from_yaml | to_json }} }"
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
no_log: true
register: create_item
when: >
not item_body.id is defined
- name: Update Item
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/{{ item.api_path }}{% if item.sub_path is defined %}/{{ item.sub_path }}{% else %}{% if item.api_path != 'Config' %}/{{ item_body.id | default('') }}{% endif %}{% endif %}"
method: "PATCH"
return_content: true
body: "{\"input\": {{ item_body | from_yaml | to_json }} }"
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
no_log: true
register: update_item
when: item_body.id is defined
- name: Fail on no action
ansible.builtin.fail:
msg: No action carried out, stop.
when: >
update_item.skipped | default(false) | bool
and
create_item.skipped | default(false) | bool
- name: Clear temp vars
ansible.builtin.set_fact:
item_body: {}
create_item: {}
update_item: {}
no_log: true

100
tasks/api/config.yaml Normal file
View File

@ -0,0 +1,100 @@
---
- name: Fetch ID for {{ list_item.body.name }}
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/{{ item.api_path }}?searchText[name]={{ list_item.body.name | urlencode }}"
method: "GET"
return_content: true
body: ''
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
no_log: true
register: glpi_search
- name: Build API Body for {{ list_item.body.name }}
ansible.builtin.set_fact:
config_item:
api_path: "{{ list_item.api_path }}"
body:
context: "{{ list_item.body.context }}"
name: "{{ list_item.body.name }}"
value: "{{ list_item.body.value }}"
when: glpi_search.json | length | int == 0
no_log: true
- name: Build API Body (with ID) for {{ list_item.body.name }}
ansible.builtin.set_fact:
config_item:
api_path: "{{ list_item.api_path }}"
body:
id: "{% for found_id in glpi_search.json %}{%if list_item.body.name == found_id.name %}{{ found_id.id }}{% endif %}{% endfor %}"
context: "{{ list_item.body.context }}"
name: "{{ list_item.body.name }}"
value: "{{ list_item.body.value }}"
when: glpi_search.json | length | int > 0
no_log: true
- name: Remove Empty ID from body
ansible.builtin.set_fact:
config_item:
api_path: "{{ list_item.api_path }}"
body:
context: "{{ list_item.body.context }}"
name: "{{ list_item.body.name }}"
value: "{{ list_item.body.value }}"
when: config_item.body.id | default('0') == ''
no_log: true
- name: "Item [{{ config_item.body.id + ']: ' + config_item.body.name }}"
ansible.builtin.debug:
msg: "{{ config_item }}"
when: config_item is defined
# ToDo: figure out why cant create item?????
# - name: Create Config Item
# ansible.builtin.uri:
# url: "http://{{ glpi.host }}/apirest.php/{{ config_item.api_path }}"
# method: "POST"
# return_content: true
# body: "{\"input\": {{ config_item.body | from_yaml | to_json }} }"
# status_code: [200, 201]
# headers:
# App-Token: "{{ glpi.app_token }}"
# Session-Token: "{{ glpi.session.valid_id }}"
# body_format: json
# # no_log: true
# when: not config_item.body.id is defined
- name: Update Config Item
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/{{ item.api_path }}/{{ config_item.body.id }}"
method: "PATCH"
return_content: true
body: "{\"input\": {{ config_item.body | from_yaml | to_json }} }"
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
no_log: true
when: config_item.body.id is defined
- name: Clear temp vars
ansible.builtin.set_fact:
config_item: {}
glpi_search: {}
list_item: {}
no_log: true

View File

@ -0,0 +1,21 @@
---
#
# Config items excluded from Adding/Updating.
#
# Each list item is the name of the config item.
#
- name: Config Items to skip
ansible.builtin.set_fact:
skip_config:
- cas_version
- dbversion
- _dbslave_status
- init_all
- instance_uuid
- notification_uuid
- proxy_passwd
- registration_uuid
- schema_version
- smtp_passwd
- version
when: item.api_path == 'Config'

45
tasks/api/search-add.yaml Normal file
View File

@ -0,0 +1,45 @@
---
- name: Ticket Template
ansible.builtin.include_tasks:
file: api/ticket_template.yaml
when: item.api_path == 'TicketTemplate'
- name: Append/Create Item
ansible.builtin.include_tasks:
file: api/append-create-item.yaml
when: >
not item.api_path == 'Config'
and
not item.api_path == 'TicketTemplate'
- name: Config Items to skip
ansible.builtin.import_tasks:
file: api/excluded_config.yaml
- name: Add/Update GLPI Config
ansible.builtin.include_tasks:
file: api/config.yaml
when: >
not sub_item.name in skip_config
and
sub_item.value is defined
loop: "{% if item.api_path == 'Config' %}{{ item.body }}{% else %}{{ [] }}{% endif %}"
loop_control:
loop_var: sub_item
vars:
list_item:
api_path: "{{ item.api_path }}"
body:
context: "{{ sub_item.context }}"
name: "{{ sub_item.name }}"
value: "{{ sub_item.value }}"
- name: Clear temp vars
ansible.builtin.set_fact:
item_body: {}
no_log: true

42
tasks/api/search.yaml Normal file
View File

@ -0,0 +1,42 @@
---
- name: Search item_id
ansible.builtin.include_tasks:
file: api/search/item_id.yaml
when: not item.body.id is defined
- name: Search entities_id
ansible.builtin.include_tasks:
file: api/search/entities_id.yaml
when: item.entities_id is defined
- name: Search groups_id
ansible.builtin.include_tasks:
file: api/search/groups_id.yaml
when: item.groups_id is defined
- name: Search itilcategories_id
ansible.builtin.include_tasks:
file: api/search/itilcategories_id.yaml
when: item.itilcategories_id is defined
- name: Search tickettemplates_id_demand
ansible.builtin.include_tasks:
file: api/search/tickettemplates_id_demand.yaml
when: item.tickettemplates_id_demand is defined
- name: Search tickettemplates_id
ansible.builtin.include_tasks:
file: api/search/tickettemplates_id.yaml
when: item.tickettemplates_id is defined
- name: Search users_id
ansible.builtin.include_tasks:
file: api/search/users_id.yaml
when: item.users_id is defined

View File

@ -0,0 +1,54 @@
---
- name: Fetch entities_id
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/Entity?searchText[name]={{ item.entities_id | urlencode }}"
method: "GET"
return_content: true
body: ''
# status_code: "{{ item.status_code | from_yaml | list }}"
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
register: glpi_search
no_log: true
- name: Iterate over results for ID search
ansible.builtin.shell:
cmd: |
cat <<EOF
{
{%- for json in glpi_search.json -%}
{%- if json.name | string == item.entities_id | string -%}
"entities_id": {{ json.id | int }}
{%- endif -%}
{%- endfor -%}
}
EOF
args:
executable: bash
register: itarate_id
changed_when: false
no_log: true
when: >
glpi_search.json | length | int > 0
- name: Set entities_id
ansible.builtin.set_fact:
new_data: "{{ itarate_id.stdout | from_yaml }}"
when: itarate_id.stdout | default({}) | length | int > 0
- name: Append entities_id
ansible.builtin.set_fact:
item_body: "{{ item_body | ansible.builtin.combine(new_data | default({})) }}"
glpi_search: {}
itarate_id: {}
new_data: {}
no_log: true

View File

@ -0,0 +1,54 @@
---
- name: Fetch users_id
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/Group?searchText[name]={{ item.groups_id | urlencode }}"
method: "GET"
return_content: true
body: ''
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
register: glpi_search
no_log: true
- name: Iterate over results for ID search
ansible.builtin.shell:
cmd: |
cat <<EOF
{
{%- for json in glpi_search.json -%}
{%- if json.name | string == item.groups_id | string -%}
"groups_id": {{ json.id | int }}
{%- endif -%}
{%- endfor -%}
}
EOF
args:
executable: bash
register: itarate_id
changed_when: false
no_log: true
when: >
glpi_search.json | length | int > 0
- name: Set groups_id
ansible.builtin.set_fact:
new_data: "{{ itarate_id.stdout | from_yaml }}"
when: itarate_id.stdout | default({}) | length | int > 0
- name: Append groups (have item_body)
ansible.builtin.set_fact:
item_body: "{{ item_body | ansible.builtin.combine(new_data | default({})) }}"
glpi_search: {}
itarate_id: {}
new_data: {}
no_log: true

View File

@ -0,0 +1,122 @@
---
- name: Find Item ID
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/{{ item.api_path }}{% if item.sub_path is defined %}/{{ item.sub_path }}{% endif%}{% if search_items | length | int > 0%}?{% for search in search_items %}searchText[{{ search.name }}]={{ search.value | urlencode }}&{% endfor %}{% else%}?searchText[name]={{ item.body.name | urlencode }}{% endif %}"
method: "GET"
return_content: true
body: ''
# status_code: "{{ item.status_code | from_yaml | list }}"
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
register: glpi_search
no_log: true
- name: Set id
ansible.builtin.set_fact:
new_data:
id: "{{ glpi_search.json[0].id | int }}"
when: glpi_search.json | length | int == 1
- name: Iterate over results for TicketTemplateMandatoryField id/TicketTemplateHiddenField
ansible.builtin.shell:
cmd: |
cat <<EOF
{
{%- for json in glpi_search.json -%}
{%- if
json.tickettemplates_id | int == item_body.tickettemplates_id | int
and
json.num | int == item_body.num | int
-%}
"id": {{ json.id | int }}
{%- endif -%}
{%- endfor -%}
}
EOF
args:
executable: bash
register: itarate_id
changed_when: false
no_log: true
when: >
glpi_search.json | length | int > 1
and
(
'TicketTemplateMandatoryField' in item.sub_path | default('')
or
'TicketTemplateHiddenField' in item.sub_path | default('')
)
- name: Set iterate id
ansible.builtin.set_fact:
new_data: "{{ itarate_id.stdout | from_yaml }}"
when: itarate_id.stdout is defined
- name: Iterate over results for TicketTemplatePredefinedField id
ansible.builtin.shell:
cmd: |
cat <<EOF
{
{%- for json in glpi_search.json -%}
{%- if
json.num | int == 13
and
json.tickettemplates_id | int == item_body.tickettemplates_id | int
and
json.num | int == item_body.num | int
and
json.value == item_body.value
-%}
"id": {{ json.id | int }}
{%- elif
json.num | int != 13
and
json.tickettemplates_id | int == item_body.tickettemplates_id | int
and
json.num | int == item_body.num | int
-%}
"id": {{ json.id | int }}
{%- endif -%}
{%- endfor -%}
}
EOF
args:
executable: bash
register: itarate_id
changed_when: false
no_log: true
when: >
glpi_search.json | length | int > 1
and
'TicketTemplatePredefinedField' in item.sub_path | default('')
- name: Set iterate id
ansible.builtin.set_fact:
new_data: "{{ itarate_id.stdout | from_yaml }}"
when: itarate_id.stdout is defined
- name: Item_id fact Cleanup
ansible.builtin.set_fact:
item_body: "{{ item_body | ansible.builtin.combine(new_data | default({})) }}"
glpi_search: {}
itarate_id: {}
new_data: {}
no_log: true

View File

@ -0,0 +1,54 @@
---
- name: Fetch itilcategories_id
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/ITILCategory?searchText[name]={{ item.itilcategories_id | urlencode }}"
method: "GET"
return_content: true
body: ''
# status_code: "{{ item.status_code | from_yaml | list }}"
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
register: glpi_search
no_log: true
- name: Iterate over results for ID search
ansible.builtin.shell:
cmd: |
cat <<EOF
{
{%- for json in glpi_search.json -%}
{%- if json.name | string == item.itilcategories_id | string -%}
"itilcategories_id": {{ json.id | int }}
{%- endif -%}
{%- endfor -%}
}
EOF
args:
executable: bash
register: itarate_id
changed_when: false
no_log: true
when: >
glpi_search.json | length | int > 0
- name: Set itilcategories_id
ansible.builtin.set_fact:
new_data: "{{ itarate_id.stdout | from_yaml }}"
when: itarate_id.stdout | default({}) | length | int > 0
- name: Append itilcategories_id
ansible.builtin.set_fact:
item_body: "{{ item_body | ansible.builtin.combine(new_data | default({})) }}"
glpi_search: {}
itarate_id: {}
new_data: {}
no_log: true

View File

@ -0,0 +1,54 @@
---
- name: Fetch tickettemplates_id
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/TicketTemplate?searchText[name]={{ item.tickettemplates_id | urlencode }}"
method: "GET"
return_content: true
body: ''
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
register: glpi_search
no_log: true
- name: Iterate over results for ID search
ansible.builtin.shell:
cmd: |
cat <<EOF
{
{%- for json in glpi_search.json -%}
{%- if json.name | string == item.tickettemplates_id | string -%}
"tickettemplates_id": {{ json.id | int }}
{%- endif -%}
{%- endfor -%}
}
EOF
args:
executable: bash
register: itarate_id
changed_when: false
no_log: true
when: >
glpi_search.json | length | int > 0
- name: Set tickettemplates_id
ansible.builtin.set_fact:
new_data: "{{ itarate_id.stdout | from_yaml }}"
when: itarate_id.stdout | default({}) | length | int > 0
- name: Append tickettemplates_id
ansible.builtin.set_fact:
item_body: "{{ item_body | ansible.builtin.combine(new_data | default({})) }}"
tickettemplates_id: "{{ new_data.tickettemplates_id | default(omit) | int }}"
glpi_search: {}
itarate_id: {}
new_data: {}
no_log: true

View File

@ -0,0 +1,54 @@
---
- name: Fetch tickettemplates_id_demand
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/TicketTemplate?searchText[name]={{ item.tickettemplates_id_demand | urlencode }}"
method: "GET"
return_content: true
body: ''
# status_code: "{{ item.status_code | from_yaml | list }}"
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
register: glpi_search
no_log: true
- name: Iterate over results for ID search
ansible.builtin.shell:
cmd: |
cat <<EOF
{
{%- for json in glpi_search.json -%}
{%- if json.name | string == item.tickettemplates_id_demand | string -%}
"tickettemplates_id_demand": {{ json.id | int }}
{%- endif -%}
{%- endfor -%}
}
EOF
args:
executable: bash
register: itarate_id
changed_when: false
no_log: true
when: >
glpi_search.json | length | int > 0
- name: Set tickettemplates_id_demand
ansible.builtin.set_fact:
new_data: "{{ itarate_id.stdout | from_yaml }}"
when: itarate_id.stdout | default({}) | length | int > 0
- name: Append tickettemplates_id_demand
ansible.builtin.set_fact:
item_body: "{{ item_body | ansible.builtin.combine(new_data | default({})) }}"
glpi_search: {}
itarate_id: {}
new_data: {}
no_log: true

View File

@ -0,0 +1,55 @@
---
- name: Fetch users_id
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/User?searchText[name]={{ item.users_id | urlencode }}"
method: "GET"
return_content: true
body: ''
# status_code: "{{ item.status_code | from_yaml | list }}"
status_code: [200, 201]
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
register: glpi_search
no_log: true
- name: Iterate over results for ID search
ansible.builtin.shell:
cmd: |
cat <<EOF
{
{%- for json in glpi_search.json -%}
{%- if json.name | string == item.users_id | string -%}
"users_id": {{ json.id | int }}
{%- endif -%}
{%- endfor -%}
}
EOF
args:
executable: bash
register: itarate_id
changed_when: false
no_log: true
when: >
glpi_search.json | length | int > 0
- name: Set users_id
ansible.builtin.set_fact:
new_data: "{{ itarate_id.stdout | from_yaml }}"
when: itarate_id.stdout | default({}) | length | int > 0
- name: Append users_id (have item_body)
ansible.builtin.set_fact:
item_body: "{{ item_body | ansible.builtin.combine(new_data | default({})) }}"
glpi_search: {}
itarate_id: {}
new_data: {}
no_log: true

View File

@ -0,0 +1,30 @@
---
- name: Fetch API Session Token
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/initSession?get_full_session=true"
method: GET
return_content: true
body: ""
status_code: 200
headers:
App-Token: "{{ glpi.app_token }}"
Authorization: "user_token {{ glpi.user_token }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
register: glpi_session_get
no_log: true
tags:
- always
- name: Session Data
ansible.builtin.set_fact:
glpi_session:
session: "{{ glpi_session_get.json.session }}"
no_log: true
- name: Session fact
ansible.builtin.set_fact:
glpi: "{{ glpi | ansible.builtin.combine(glpi_session) }}"
no_log: true

View File

@ -0,0 +1,14 @@
---
- name: End API Session
ansible.builtin.uri:
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/killSession"
method: GET
return_content: true
body: ''
status_code: 200
headers:
App-Token: "{{ glpi.app_token }}"
Session-Token: "{{ glpi_session_get.json.session.valid_id }}"
body_format: json
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
no_log: true

View File

@ -0,0 +1,103 @@
---
- name: Template item
ansible.builtin.set_fact:
template_item: "{{ item }}"
- name: Append/Create TicketTemplate
ansible.builtin.include_tasks:
file: api/append-create-item.yaml
when: item.api_path == 'TicketTemplate'
vars:
item:
api_path: TicketTemplate
entities_id: "{{ template_item.entities_id }}"
body: "{{ template_item.body }}"
- name: Search tickettemplates_id
ansible.builtin.include_tasks:
file: api/search/tickettemplates_id.yaml
vars:
item:
tickettemplates_id: "{{ template_item.body.name }}"
- name: Append/Create Ticket Template Mandatory Fields
ansible.builtin.include_tasks:
file: api/append-create-item.yaml
when: >
template_item._TicketTemplateMandatoryField is defined
and
template_item._TicketTemplateMandatoryField | length | int > 0
loop: "{{ template_item._TicketTemplateMandatoryField }}"
loop_control:
loop_var: sub_item
vars:
search_items:
- name: tickettemplates_id
value: "{{ tickettemplates_id }}"
- name: num
value: "{{ sub_item.num }}"
item:
api_path: TicketTemplate
sub_path: "{{ tickettemplates_id }}/TicketTemplateMandatoryField"
body:
num: "{{ sub_item.num }}"
tickettemplates_id: "{{ tickettemplates_id | int }}"
- name: Append/Create Ticket Template Predefined Fields
ansible.builtin.include_tasks:
file: api/append-create-item.yaml
when: >
template_item._TicketTemplatePredefinedField is defined
and
template_item._TicketTemplatePredefinedField | length | int > 0
loop: "{{ template_item._TicketTemplatePredefinedField }}"
loop_control:
loop_var: sub_item
vars:
search_items:
- name: tickettemplates_id
value: "{{ tickettemplates_id }}"
- name: num
value: "{{ sub_item.num }}"
item:
api_path: TicketTemplate
sub_path: "{{ tickettemplates_id }}/TicketTemplatePredefinedField"
body:
num: "{{ sub_item.num | int }}"
tickettemplates_id: "{{ tickettemplates_id | int }}"
value: "{{ sub_item.value | string }}"
- name: Append/Create Ticket Template Hidden Fields
ansible.builtin.include_tasks:
file: api/append-create-item.yaml
when: >
template_item._TicketTemplateHiddenField is defined
and
template_item._TicketTemplateHiddenField | length | int > 0
loop: "{{ template_item._TicketTemplateHiddenField }}"
loop_control:
loop_var: sub_item
vars:
search_items:
- name: tickettemplates_id
value: "{{ tickettemplates_id }}"
- name: num
value: "{{ sub_item.num }}"
item:
api_path: TicketTemplate
sub_path: "{{ tickettemplates_id }}/TicketTemplateHiddenField"
body:
num: "{{ sub_item.num | int }}"
tickettemplates_id: "{{ tickettemplates_id | int }}"
- name: Clear temp vars
ansible.builtin.set_fact:
template_item: {}
no_log: true

111
tasks/configure.yaml Normal file
View File

@ -0,0 +1,111 @@
---
- name: Clear Any downloaded files
ansible.builtin.file:
name: "/tmp/ansible"
state: absent
#loop: "{{ glpi_plugins }}"
- name: Clear Any downloaded files
ansible.builtin.file:
name: "/tmp/ansible"
state: directory
#loop: "{{ glpi_plugins }}"
# - name: Download Plugins
# ansible.builtin.get_url:
# url: "{{ item.url }}"
# dest: "/tmp/{{ item.filename }}"
# loop: "{{ glpi_plugins }}"
# - name: Download plugins
# ansible.builtin.command:
# cmd: "bash -c echo $({{ item.url }})"
# loop: "{{ glpi_plugins }}"
# wget https://github.com/pluginsGLPI/formcreator/releases/download/2.13.6/glpi-formcreator-2.13.6.tar.bz2 -O /tmp/plugin-form-creator.tar.bz2
# tar -xjf /tmp/plugin-form-creator.tar.bz2 -C /var/lib/docker/volumes/glpi_glpi_plugins/_data/
# wget https://github.com/glpi-project/glpi-inventory-plugin/releases/download/1.2.3/glpi-glpiinventory-1.2.3.tar.bz2 -O /tmp/glpi-glpiinventory-1.2.3.tar.bz2
# tar -xjf /tmp/glpi-glpiinventory-1.2.3.tar.bz2 -C /var/lib/docker/volumes/glpi_glpi_plugins/_data/
# chown www-data:www-data -R /var/lib/docker/volumes/glpi_glpi_plugins/_data/
- name: Install bzip
ansible.builtin.apt:
name: "{{ item }}"
state: present
loop: "{{ apps }}"
vars:
apps:
- bzip2
- jq
- wget
# - name: Example clone of a single branch
# ansible.builtin.git:
# repo: "{{ item.repo }}.git"
# dest: "/var/lib/docker/volumes/plugins_glpi/_data/{{ item.name }}"
# single_branch: true
# version: "{{ item.version }}"
# depth: 1
# force: true
# loop: "{{ plugins }}"
# vars:
# plugins:
# - name: actualtime
# repo: https://github.com/ticgal/actualtime
# version: 2.1.0
# - name: glpiinventory
# repo: https://github.com/glpi-project/glpi-inventory-plugin
# version: 1.2.3
# # for creator doesnt work
# # - name: formcreator
# # repo: https://github.com/pluginsGLPI/formcreator
# # version: 2.13.6
# - name: geninventorynumber
# repo: https://github.com/pluginsGLPI/geninventorynumber
# version: 2.8.3
# - name: releases
# repo: https://github.com/InfotelGLPI/releases
# version: 2.0.3
# - name: phpsaml
# repo: https://github.com/DonutsNL/phpsaml
# # version: e7357a49ca9f0b612bc28879a0c703cdbfc4463b
# version: master
# - name: Download and Extract the plugins
# ansible.builtin.shell:
# cmd: |
# export URL=$(curl -s {{ item.url }} | jq .assets[0].browser_download_url | tr -d \");
# wget $URL -O /tmp/ansible/$(basename ${URL});
# tar -xjf /tmp/ansible/$(basename ${URL}) -C /var/lib/docker/volumes/plugins_glpi/_data/;
# loop: "{{ glpi_plugins }}"
# changed_when: false
- name: Fix file perms
ansible.builtin.command:
cmd: chown www-data:www-data -R /var/lib/docker/volumes/plugins_glpi/_data/
changed_when: false
# - name: Unarchive a file that needs to be downloaded (added in 2.0)
# ansible.builtin.unarchive:
# src: /tmp/{{ item.filename }}
# dest: /var/lib/docker/volumes/plugins_glpi/_data/
# remote_src: true
# extra_opts:
# - -j
# loop: "{{ glpi_plugins }}"
- name: Clear Any downloaded files
ansible.builtin.file:
name: "{{ item.filename }}"
state: absent
loop: "{{ glpi_plugins }}"
- name: Reload logroate if required
ansible.builtin.meta: flush_handlers

150
tasks/install.yaml Normal file
View File

@ -0,0 +1,150 @@
---
- name: GPLI Docker Container
ansible.builtin.include_role:
name: docker_management
vars:
docker_images:
- name: "{{ docker_image_name_glpi }}"
tag: "{{ docker_image_tag_glpi }}"
docker_networks:
- name: "{{ docker_container_name_glpi }}-access"
internal: false # this needs to be added to the docker role
- name: "{{ docker_container_name_glpi }}-smtp-access"
internal: true
docker_containers:
- name: "{{ docker_container_name_glpi }}"
image: "{{ docker_image_name_glpi }}:{{ docker_image_tag_glpi }}"
env:
TIMEZONE: UTC
networks:
- name: "{{ docker_container_name_glpi }}-access"
- name: "ingress-access"
- name: "{{ docker_container_name_glpi }}-smtp-access"
- name: ldap-access
- name: mysql-access
# published_ports:
# - 80:80
volumes:
- /usr/share/zoneinfo/Etc/UTC:/etc/timezone:ro
- /usr/share/zoneinfo/Etc/UTC:/etc/localtime:ro
- "config_{{ docker_container_name_glpi }}:/var/www/html/config"
- "data_{{ docker_container_name_glpi }}:/var/www/html/files"
- "log_{{ docker_container_name_glpi }}:/var/log"
- "marketplace_{{ docker_container_name_glpi }}:/var/www/html/marketplace"
- "plugins_{{ docker_container_name_glpi }}:/var/www/html/plugins"
docker_volumes:
- name: "plugins_{{ docker_container_name_glpi }}"
- name: "data_{{ docker_container_name_glpi }}"
- name: "config_{{ docker_container_name_glpi }}"
- name: "marketplace_{{ docker_container_name_glpi }}"
- name: "log_{{ docker_container_name_glpi }}"
- name: "varlog_{{ docker_container_name_glpi }}"
- name: Create GLPI database
community.mysql.mysql_db:
name: "{{ mysql_database_glpi }}"
state: present
login_unix_socket: "{{ mysql_unix_socket }}"
login_user: "{{ mysql_login_user }}"
login_password: "{{ mysql_login_password }}"
login_host: "{{ mysql_login_host | default('') }}"
config_file: ''
- name: Create user with password, all database privileges and 'WITH GRANT OPTION' in db1 and db2
community.mysql.mysql_user:
state: "{{ item.state | default('present') }}"
name: "{{ item.name }}"
password: "{{ item.password }}"
host: "{{ item.host | default('localhost') }}"
priv: "{{ item.priv | default(omit) | from_yaml }}"
update_password: "{{ item.update_password | default('on_create') }}"
login_host: "{{ mysql_login_host | default('') }}"
login_unix_socket: "{{ mysql_unix_socket }}"
login_user: "{{ mysql_login_user }}"
login_password: "{{ mysql_login_password }}"
config_file: ''
loop: "{{ database_mysql_users }}"
vars:
database_mysql_users:
- name: glpi
password: admin
host: '%'
priv:
'glpi.*': 'ALL,GRANT'
# sudo cp -r /var/www/html/glpi/config/* /var/lib/docker/volumes/glpi_config_glpi/_data/
# sudo cp -r /var/www/html/glpi/files/* /var/lib/docker/volumes/glpi_data_glpi/_data/
# sudo cp -r /var/www/html/glpi/plugins/* /var/lib/docker/volumes/glpi_glpi_plugins/_data/
# sudo cp -r /var/www/html/glpi/marketplace/* /var/lib/docker/volumes/glpi_marketplace_glpi/_data/
# sudo chmod -R 777 /var/lib/docker/volumes/glpi_config_glpi/_data/
# sudo chmod -R 777 /var/lib/docker/volumes/glpi_data_glpi/_data/
# sudo chmod -R 777 /var/lib/docker/volumes/glpi_glpi_plugins/_data/
# sudo chmod -R 777 /var/lib/docker/volumes/glpi_marketplace_glpi/_data/
- name: Add fail2ban filters
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: '760'
owner: root
group: root
loop: "{{ the_files }}"
# notify: reload_fail2ban
when: >
install_fail2ban | default(false) | bool
vars:
the_files:
- src: fail2ban.filter.conf
dest: "/etc/fail2ban/filter.d/glpi.local"
- src: fail2ban.filter.conf
dest: "/etc/fail2ban/filter.d/glpi-api.local"
- name: "Fail2Ban Jail for GLPI"
ansible.builtin.include_role:
name: nfc_firewall
when: >
install_fail2ban | default(false) | bool
vars:
fail2ban:
config:
- name: "glpi-{{ docker_container_name_glpi }}"
sub_path: jail.d
sections:
DEFAULT:
"glpi_log": "/var/lib/docker/volumes/data_{{ docker_container_name_glpi }}/_data/_log/event.log"
glpi:
enabled: true
mode: polling
chain: DOCKER-USER
port: http,https
logpath: "%(glpi_log)s"
filter: glpi
findtime: 600
maxretry: 5
- name: "api_glpi-{{ docker_container_name_glpi }}"
sub_path: jail.d
sections:
DEFAULT:
"api_glpi_log": "/var/lib/docker/volumes/log_{{ docker_container_name_glpi }}/_data/apache2/access-glpi.log"
api_glpi:
enabled: true
mode: polling
chain: DOCKER-USER
port: http,https
logpath: "%(api_glpi_log)s"
filter: glpi-api
findtime: 600
maxretry: 5
- name: Task Final playbook variables
ansible.builtin.set_fact:
glpi_installed: true

40
tasks/main.yaml Normal file
View File

@ -0,0 +1,40 @@
---
- name: Install GLPI
ansible.builtin.include_tasks:
file: install.yaml
apply:
tags:
- always
tags:
- always
when: >
install_glpi | bool
and
not glpi_installed | bool
- name: Configure Log Rotate
ansible.builtin.include_tasks:
file: configure.yaml
apply:
tags:
- always
tags:
- always
when: glpi_installed | bool
# and
# ansible_os_family == "Debian"
# and
# (
# logrotate is defined
# and
# logrotate | default([]) | length | int > 0
# )
- name: API tasks
ansible.builtin.include_tasks:
file: api/api.yaml
apply:
tags:
- always
when: glpi_config_as_code_json | length | int > 0

View File

@ -0,0 +1,15 @@
#
# Fail2ban Filter, GLPI API Denied access
#
# Managed By: Ansible
# Role: nfc_glpi
#
# Do not edit this file directly as it will be automagically updated by ansible.
# to make changes update the ansible play that deploys this file.
[Init]
maxlines = 2
[Definition]
failregex = ^(<HOST>[\d|\.?]{1,3}).+apirest.php.+"\s40\d\s\d{1,5}

View File

@ -0,0 +1,17 @@
#
# Fail2ban Filter, GLPI
#
# Managed By: Ansible
# Role: nfc_glpi
#
# Do not edit this file directly as it will be automagically updated by ansible.
# to make changes update the ansible play that deploys this file.
[Init]
maxlines = 2
[Definition]
# failregex = ^(?P<DATETIME>\d{4}-\d{2}-\d{2}\s?\d{2}:\d{2}:\d{2})\s+?\S+\n?\[login\]\s+?[\d+]?:?[\s+]?Failed\s+?login\s+?for\s(?P<USER>.+)\s+?from\s+?IP\s+?(?P<HOST>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$
# failregex = ^(.+)ogin] \d+: Failed login for (.+) from IP (<HOST>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$
failregex = ^.*?(Failed login for)[\S\s]+(from IP) <HOST>.*$
# ^.*\s(\[\S).*?(Failed login for) \S+ (from IP) <HOST>.*$

1
website-template Submodule

Submodule website-template added at 8735f623dc