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

tower_ah_url only referenced in defaults as localhost #51

Closed
djdanielsson opened this issue Oct 5, 2021 · 5 comments · Fixed by #52
Closed

tower_ah_url only referenced in defaults as localhost #51

djdanielsson opened this issue Oct 5, 2021 · 5 comments · Fixed by #52

Comments

@djdanielsson
Copy link
Contributor

djdanielsson commented Oct 5, 2021

https://github.com/redhat-cop/tower_utilities/blob/dfe8f4a316f7dfc2fe339f41c42dcc949ec8bbe5/roles/install/tasks/tower_install.yml#L51

install fails because this is trying to hit localhost when checking if AH is up and running and not the host that AH is installed on. This value is set in defaults here
https://github.com/redhat-cop/tower_utilities/blob/dfe8f4a316f7dfc2fe339f41c42dcc949ec8bbe5/roles/install/defaults/main.yml#L9

@djdanielsson
Copy link
Contributor Author

I am looking into a fix, I tried changing the defaults to tower_ah_url: "https://{{ tower_ah_nodes[0] | default('localhost') }}" but it didn't seem to work. It works when I put it in my main vars but I thought you might want to avoid that. What do you think?

@Tompage1994
Copy link
Collaborator

The obvious solution is to just set the value of tower_ah_url in your playbook. I do, however, like the idea of setting it to be related to tower_ah_nodes, although that might not work in all circumstances (e.g. if you defined some host specific vars under tower_ah_hosts - bit of a hack but can be done).

I'm not entirely sure why your example does not work. When i put together a simple debugging playbook it does seem to:

---
- hosts: localhost
  vars:
    tower_ah_nodes:
      - ahnode.example.com
  tasks:
    - debug:
        msg: "https://{{ tower_ah_nodes[0] | default('localhost') }}"

results in

TASK [debug] *************************************************************************************
ok: [localhost] => {
    "msg": "https://ah-node-dc1.example.com"

and setting tower_ah_nodes: [] (as per default) you get

ok: [localhost] => {
    "msg": "https://localhost"
}

So seemingly working?

@djdanielsson
Copy link
Contributor Author

I might not have been clear, it does work when I have it in my vars file with everything else, it does not however work when I modified the defaults file to that instead of directly setting it to localhost. I will test again to confirm that it does not work in defaults or if it was some oversight on my part that caused it to not work when I first tried it.

@djdanielsson
Copy link
Contributor Author

Ok I figured it out I was being stupid and modified the wrong defaults/main.yml which is why it didn't work for me. But you said you didn't like this as a full on fix?

@Tompage1994
Copy link
Collaborator

No, I'm happy for the default to be set as tower_ah_nodes[0]. For instances where tower_ah_nodes is set as something where this just wouldnt work, the user can just use their own value for tower_ah_url

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 a pull request may close this issue.

2 participants