@ -23,7 +23,7 @@
|
||||
|
||||
- name: Create Item
|
||||
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"
|
||||
return_content: true
|
||||
body: "{\"input\": {{ item_body | from_yaml | to_json }} }"
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
- name: Update Item
|
||||
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"
|
||||
return_content: true
|
||||
body: "{\"input\": {{ item_body | from_yaml | to_json }} }"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
- name: Fetch ID for {{ list_item.body.name }}
|
||||
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"
|
||||
return_content: true
|
||||
body: ''
|
||||
@ -77,7 +77,7 @@
|
||||
|
||||
- name: Update Config Item
|
||||
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"
|
||||
return_content: true
|
||||
body: "{\"input\": {{ config_item.body | from_yaml | to_json }} }"
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Fetch entities_id
|
||||
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"
|
||||
return_content: true
|
||||
body: ''
|
||||
@ -11,6 +11,7 @@
|
||||
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
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
- name: Fetch users_id
|
||||
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"
|
||||
return_content: true
|
||||
body: ''
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Find Item ID
|
||||
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"
|
||||
return_content: true
|
||||
body: ''
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Fetch itilcategories_id
|
||||
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"
|
||||
return_content: true
|
||||
body: ''
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Fetch tickettemplates_id
|
||||
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"
|
||||
return_content: true
|
||||
body: ''
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Fetch tickettemplates_id_demand
|
||||
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"
|
||||
return_content: true
|
||||
body: ''
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
- name: Fetch users_id
|
||||
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"
|
||||
return_content: true
|
||||
body: ''
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Fetch API Session Token
|
||||
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
|
||||
return_content: true
|
||||
body: ""
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: End API Session
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ glpi.host }}/apirest.php/killSession"
|
||||
url: "{{ http_protocol | default('https') | string }}://{{ glpi.host }}/apirest.php/killSession"
|
||||
method: GET
|
||||
return_content: true
|
||||
body: ''
|
||||
|
Reference in New Issue
Block a user