-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Refactor controller role to use variables for hostname and host index #3206
Conversation
dubee
commented
Jan 19, 2018
•
edited
edited
- Define variables for frequently referenced operations in controller role
- Move controller.jmxremote.jvmArgs to deploy.yml
@cbickel, can you look at this one when you have a chance? It's just refactoring the controller deployment scripts to make them easier to manage/read. |
@@ -48,17 +56,17 @@ | |||
|
|||
- name: prepare controller ports | |||
set_fact: | |||
ports_to_expose: ["{{ controller.basePort + groups['controllers'].index(inventory_hostname) }}:8080", "{{ controller.akka.cluster.basePort + groups['controllers'].index(inventory_hostname) }}:{{ controller.akka.cluster.bindPort }}"] | |||
ports_to_expose: ["{{ controller.basePort + (controller_index | int) }}:8080", "{{ controller.akka.cluster.basePort + (controller_index | int) }}:{{ controller.akka.cluster.bindPort }}"] |
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 it possible to do the int
conversation already on defining the variable? Or would this result in issues on gernerating the name-String?
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.
@cbickel, unfortunately defining the controller_index
as an int
results in the variable type being unicode
. See below.
Define controller_index
as an int:
- name: get controller index
set_fact:
controller_index: "{{ groups['controllers'].index(inventory_hostname) | int }}"
Attempting to add controller_index
to an int:
{{ controller.basePort + controller_index }}
Results in this error:
fatal: [192.168.99.100]: FAILED! => {"failed": true, "msg": "Unexpected templating type error occurred on ({{ controller.basePort + controller_index }}:8080): unsupported operand type(s) for +: 'int' and 'unicode'"}
Apparently using set_fact
always produces a string: ansible/ansible#4170.
- Define variables for frequently referenced operations controller role - Move controller.jmxremote.jvmArgs to deploy.yml
5ce6f19
to
14a2efe
Compare
PG3 1821 👍 |
@cbickel, PG looks good. |
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.
LGTM
…x. (apache#3206) - Define variables for frequently referenced operations controller role - Move controller.jmxremote.jvmArgs to deploy.yml