Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Default API Port #1064

Merged
merged 1 commit into from
Aug 19, 2023

Conversation

pyrodie18
Copy link
Collaborator

@pyrodie18 pyrodie18 commented Aug 11, 2023

SUMMARY

Updated default value of zabbix_api_server_port based on the value of 'zabbix_api_use_ssl'

Related to #1048

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

Proxy and agent roles

@@ -246,7 +246,7 @@ Host encryption configuration will be set to match agent configuration.

* `zabbix_api_server_host`: The IP or hostname/FQDN of Zabbix server. Example: zabbix.example.com
* `zabbix_api_use_ssl`: Is SSL required to connect to the Zabbix API server? Default: `false`
* `zabbix_api_server_port`: TCP port to use to connect to Zabbix server. Example: 8080
* `zabbix_api_server_port`: 80 if `zabbix_api_use_ssl` is `false` and 443 if `true` (Default) TCP port to use to connect to Zabbix server. Example: 8080
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think default for zabbix_api_use_ssl it false

@@ -269,7 +269,7 @@ These variables need to be overridden when you want to make use of the Zabbix AP

* `zabbix_api_server_host`: The IP or hostname/FQDN of Zabbix server. Example: zabbix.example.com
* `zabbix_api_use_ssl`: Is SSL required to connect to the Zabbix API server? Default: `false`
* `zabbix_api_server_port`: TCP port to use to connect to Zabbix server. Example: 8080
* `zabbix_api_server_port`: 80 if `zabbix_api_use_ssl` is `false` and 443 if `true` (Default) TCP port to use to connect to Zabbix server. Example: 8080
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think default for zabbix_api_use_ssl it false

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what I was trying to say is that those two actions (combined) is the default behavior, or you can override it to whatever you want. How would you word it?

@@ -68,7 +68,7 @@ zabbix_repo_yum:

# Zabbix API stuff
zabbix_api_server_host: localhost
zabbix_api_server_port: 80
# zabbix_api_server_port: 80
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having all the vars in defaults/main.yml, is there a reason you want to remove this line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because if you look at line 28 in the agent role, if zabbix_api_server_port is defined, it will always use that one. It will only default if its not defined (to allow someone to override the port)

@@ -112,7 +112,7 @@ zabbix_proxy_vmwarefrequency: 60
# Zabbix API stuff
zabbix_api_server_host: localhost
zabbix_api_use_ssl: false
zabbix_api_server_port: 80
# zabbix_api_server_port: 80
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having all the vars in defaults/main.yml, is there a reason you want to remove this line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

@pyrodie18 pyrodie18 merged commit 79b46bb into ansible-collections:main Aug 19, 2023
176 checks passed
@pyrodie18 pyrodie18 deleted the 1048_default_api_port branch August 19, 2023 18:51
@loricvdt
Copy link
Contributor

loricvdt commented Sep 5, 2023

Hi, there seems to be an issue with the zabbix_api_server_port when it is undefined when calling the API:
(I have added a few debug steps to see what is happening)

TASK [community.zabbix.zabbix_proxy : Configure zabbix-proxy] ******************
ok: [zabbix-proxy]

TASK [community.zabbix.zabbix_proxy : Debug] ***********************************
ok: [zabbix-proxy -> 172.18.0.3] => {
    "zabbix_api_server_port": "80"
}

TASK [community.zabbix.zabbix_proxy : Debug] ***********************************
ok: [zabbix-proxy] => {
    "ansible_httpapi_port": "80"
}

TASK [community.zabbix.zabbix_proxy : Debug] ***********************************
ok: [zabbix-proxy -> 172.18.0.3] => {
    "ansible_httpapi_port": "80"
}

TASK [community.zabbix.zabbix_proxy : Ensure proxy definition is up-to-date (added/updated/removed)] ***
fatal: [zabbix-proxy -> 172.18.0.3]: FAILED! => {"msg": "'zabbix_api_server_port' is undefined. 'zabbix_api_server_port' is undefined"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants