diff --git a/tasks/api/append-create-item.yaml b/tasks/api/append-create-item.yaml index 6a392c9..3a72a04 100644 --- a/tasks/api/append-create-item.yaml +++ b/tasks/api/append-create-item.yaml @@ -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 }} }" diff --git a/tasks/api/config.yaml b/tasks/api/config.yaml index 6f18d99..20d4f41 100644 --- a/tasks/api/config.yaml +++ b/tasks/api/config.yaml @@ -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 }} }" diff --git a/tasks/api/search/entities_id.yaml b/tasks/api/search/entities_id.yaml index c0de592..de0c3c2 100644 --- a/tasks/api/search/entities_id.yaml +++ b/tasks/api/search/entities_id.yaml @@ -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 diff --git a/tasks/api/search/groups_id.yaml b/tasks/api/search/groups_id.yaml index 51bbcfe..e27ae0c 100644 --- a/tasks/api/search/groups_id.yaml +++ b/tasks/api/search/groups_id.yaml @@ -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: '' diff --git a/tasks/api/search/item_id.yaml b/tasks/api/search/item_id.yaml index 10fe58b..024a6fc 100644 --- a/tasks/api/search/item_id.yaml +++ b/tasks/api/search/item_id.yaml @@ -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: '' diff --git a/tasks/api/search/itilcategories_id.yaml b/tasks/api/search/itilcategories_id.yaml index 6fdb33a..007708f 100644 --- a/tasks/api/search/itilcategories_id.yaml +++ b/tasks/api/search/itilcategories_id.yaml @@ -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: '' diff --git a/tasks/api/search/tickettemplates_id.yaml b/tasks/api/search/tickettemplates_id.yaml index dddcf2b..f654d86 100644 --- a/tasks/api/search/tickettemplates_id.yaml +++ b/tasks/api/search/tickettemplates_id.yaml @@ -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: '' diff --git a/tasks/api/search/tickettemplates_id_demand.yaml b/tasks/api/search/tickettemplates_id_demand.yaml index 396662f..3f1adf8 100644 --- a/tasks/api/search/tickettemplates_id_demand.yaml +++ b/tasks/api/search/tickettemplates_id_demand.yaml @@ -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: '' diff --git a/tasks/api/search/users_id.yaml b/tasks/api/search/users_id.yaml index 68f653d..6946384 100644 --- a/tasks/api/search/users_id.yaml +++ b/tasks/api/search/users_id.yaml @@ -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: '' diff --git a/tasks/api/session-create.yaml b/tasks/api/session-create.yaml index 1a430d0..ec88a10 100644 --- a/tasks/api/session-create.yaml +++ b/tasks/api/session-create.yaml @@ -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: "" diff --git a/tasks/api/session-end.yaml b/tasks/api/session-end.yaml index 3e771db..b2e2922 100644 --- a/tasks/api/session-end.yaml +++ b/tasks/api/session-end.yaml @@ -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: ''