@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
- name: Create Item
|
- name: Create Item
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/{{ item.api_path }}{% if item.sub_path is defined %}/{{ item.sub_path }}{% endif %}"
|
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"
|
method: "POST"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: "{\"input\": {{ item_body | from_yaml | to_json }} }"
|
body: "{\"input\": {{ item_body | from_yaml | to_json }} }"
|
||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
- name: Update Item
|
- name: Update Item
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ 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 %}"
|
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"
|
method: "PATCH"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: "{\"input\": {{ item_body | from_yaml | to_json }} }"
|
body: "{\"input\": {{ item_body | from_yaml | to_json }} }"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
- name: Fetch ID for {{ list_item.body.name }}
|
- name: Fetch ID for {{ list_item.body.name }}
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/{{ item.api_path }}?searchText[name]={{ list_item.body.name | urlencode }}"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/{{ item.api_path }}?searchText[name]={{ list_item.body.name | urlencode }}"
|
||||||
method: "GET"
|
method: "GET"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
- name: Update Config Item
|
- name: Update Config Item
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/{{ item.api_path }}/{{ config_item.body.id }}"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/{{ item.api_path }}/{{ config_item.body.id }}"
|
||||||
method: "PATCH"
|
method: "PATCH"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: "{\"input\": {{ config_item.body | from_yaml | to_json }} }"
|
body: "{\"input\": {{ config_item.body | from_yaml | to_json }} }"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Fetch entities_id
|
- name: Fetch entities_id
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/Entity?searchText[name]={{ item.entities_id | urlencode }}"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/Entity?searchText[name]={{ item.entities_id | urlencode }}"
|
||||||
method: "GET"
|
method: "GET"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
@ -11,6 +11,7 @@
|
|||||||
App-Token: "{{ glpi.app_token }}"
|
App-Token: "{{ glpi.app_token }}"
|
||||||
Session-Token: "{{ glpi.session.valid_id }}"
|
Session-Token: "{{ glpi.session.valid_id }}"
|
||||||
body_format: json
|
body_format: json
|
||||||
|
validate_certs: "{{ glpi.validate_certs | default(true) | bool }}"
|
||||||
register: glpi_search
|
register: glpi_search
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
- name: Fetch users_id
|
- name: Fetch users_id
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/Group?searchText[name]={{ item.groups_id | urlencode }}"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/Group?searchText[name]={{ item.groups_id | urlencode }}"
|
||||||
method: "GET"
|
method: "GET"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Find Item ID
|
- name: Find Item ID
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ 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 %}"
|
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"
|
method: "GET"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Fetch itilcategories_id
|
- name: Fetch itilcategories_id
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/ITILCategory?searchText[name]={{ item.itilcategories_id | urlencode }}"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/ITILCategory?searchText[name]={{ item.itilcategories_id | urlencode }}"
|
||||||
method: "GET"
|
method: "GET"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Fetch tickettemplates_id
|
- name: Fetch tickettemplates_id
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/TicketTemplate?searchText[name]={{ item.tickettemplates_id | urlencode }}"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/TicketTemplate?searchText[name]={{ item.tickettemplates_id | urlencode }}"
|
||||||
method: "GET"
|
method: "GET"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Fetch tickettemplates_id_demand
|
- name: Fetch tickettemplates_id_demand
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/TicketTemplate?searchText[name]={{ item.tickettemplates_id_demand | urlencode }}"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/TicketTemplate?searchText[name]={{ item.tickettemplates_id_demand | urlencode }}"
|
||||||
method: "GET"
|
method: "GET"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
- name: Fetch users_id
|
- name: Fetch users_id
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/User?searchText[name]={{ item.users_id | urlencode }}"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/User?searchText[name]={{ item.users_id | urlencode }}"
|
||||||
method: "GET"
|
method: "GET"
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Fetch API Session Token
|
- name: Fetch API Session Token
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/initSession?get_full_session=true"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/initSession?get_full_session=true"
|
||||||
method: GET
|
method: GET
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ""
|
body: ""
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: End API Session
|
- name: End API Session
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ glpi.host }}/apirest.php/killSession"
|
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/killSession"
|
||||||
method: GET
|
method: GET
|
||||||
return_content: true
|
return_content: true
|
||||||
body: ''
|
body: ''
|
||||||
|
Reference in New Issue
Block a user