-
Notifications
You must be signed in to change notification settings - Fork 87
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
Fix: allow different proxy settings for control node and remote host #290
base: main
Are you sure you want to change the base?
Conversation
Since the http_proxy, https_proxy urls are different for me on localhost and on the remote target, the alloy role becomes useless. When setting `apply: environment:` in the `include_role` block, either localhost http request are broken or on the remote.
Based on your PR change, I assume that you are unable to communicate with the GitHub endpoint in a specific environment to determine what the "latest" release is. If that’s the case, you can resolve this by using Alternatively, you can specify the version directly in the format |
@@ -12,6 +12,7 @@ | |||
run_once: true | |||
check_mode: false | |||
register: __github_latest_version | |||
environment: "{{ alloy_localhost_environment }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any specific reason to delegate this task to localhost? If not, we could remove line 11 with delegate_to
, which I believe would solve the problem too (ps: I just came across this in an installation in an environment where we use proxy)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for using run_once
and delegate_to: localhost
is that we cannot assume or predict your specific environment. There are many ways to run Ansible, so the goal is to ensure the task of scraping the GitHub API to find the latest version is executed only once, even when the role runs on multiple hosts.
Additionally, it is common for Ansible to be executed from a dedicated Ansible control host, or through tools like AWX or AAP. By delegating the task to localhost and using run_once, the task runs only on the machine where Ansible is triggered, which is, in my opinion, the most logical approach.
That said, you can choose to specify the version directly, which avoids this issue altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, we included the version statically to get around the "problem", but to identify what to do, it was necessary to look at the tasks and identify that the problem was not related to our hosts, but rather to what was being done to the latest version, the error outputs were only indicating timeout for api.github.com.
Therefore, I believe that just one observation in the documentation for the alloy_version parameter, indicating that using the "latest" version may not present the expected behavior in environments that use a proxy, would be sufficient.
I think this PR can be closed now as the issue is clear. Feel free to raise a PR to optimize the README for the latest version, as it requires connectivity to the GitHub API. |
Since the http_proxy, https_proxy urls are different for me on localhost and on the remote target, the alloy role becomes useless. When setting
apply: environment:
in theinclude_role
block, either localhost http request are broken or on the remote.This PR fixes this issue by allowing for an
alloy_locahost_environment
variable to be set, independently of theapply: environment
mechanism