Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/ZABBIX_CRUD_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ See `defaults/main.yml` for more details.
`zabbix_api_use_ssl`: use SSL for httpapi connection, `false` by default.
`zabbix_api_validate_certs`: validate certs for httpapi connection, `false` by default.
`zabbix_api_zabbix_url_path`: path to web directory or alias, `zabbix` by default.
`zabbix_api_http_user`: login user, `Admin` by default.
`zabbix_api_http_password`: login password, `zabbix` by default.
`zabbix_api_login_user`: Username of user which has API access.
`zabbix_api_login_pass`: Password for the user which has API access.
`zabbix_api_http_user`: The http user to access zabbix url with Basic Auth (if your Zabbix is behind a proxy with HTTP Basic Auth).
`zabbix_api_http_password`: The http password to access zabbix url with Basic Auth (if your Zabbix is behind a proxy with HTTP Basic Auth).
`zabbix_api_auth_key`: API token for access. Not set by default.

# Example Playbook
Expand Down
4 changes: 2 additions & 2 deletions roles/zabbix_crud/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ zabbix_api_server_port: 80
zabbix_api_url_path: 'zabbix'
zabbix_api_use_ssl: false
zabbix_api_validate_certs: false
zabbix_api_http_user: Admin
zabbix_api_http_password: !unsafe zabbix
zabbix_api_login_user: Admin
zabbix_api_login_pass: !unsafe zabbix
# zabbix_api_auth_key: a_previously_generated_token


Expand Down
8 changes: 6 additions & 2 deletions roles/zabbix_crud/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@

- name: '[Zabbix CRUD] Set password access'
ansible.builtin.set_fact:
ansible_user: "{{ zabbix_api_http_user }}"
ansible_httpapi_pass: "{{ zabbix_api_http_password }}"
# --- Basic Auth (Begin) ---
http_login_user: "{{ zabbix_api_http_user | default(-42) }}"
http_login_password: "{{ zabbix_api_http_password | default(-42) }}"
# --- Basic Auth (End) ---
ansible_user: "{{ zabbix_api_login_user }}"
ansible_httpapi_pass: "{{ zabbix_api_login_pass }}"
when: not token_access

- name: '[Zabbix CRUD] Set token access'
Expand Down
Loading