-
Notifications
You must be signed in to change notification settings - Fork 80
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
Implement suggested changes from #40 #54
base: master
Are you sure you want to change the base?
Conversation
Thanks for the contribution! I now see what you're doing here and I'm totally cool with merging it when we get it where I like it. To start off:
Your hunch is correct about this. Instead of the conditional checking, ansible basically has a built in mechanism to prioritize variable assignments. Defaults are at the bottom of the barrel and can always be overridden. Which is to say, anything in So, the logic that you've worked through here is sound and can be replicated by using For example: {% if rocket_chat_mongodb_user is defined and rocket_chat_mongodb_password is defined %}
{% set rocket_chat_mongodb_credentials = rocket_chat_mongodb_user+":"+rocket_chat_mongodb_password+"@" -%}
{% else %}
{% set rocket_chat_mongodb_credentials = "" -%}
{% endif %}
{% if rocket_chat_mongodb_database is defined %}
{% set rocket_chat_mongodb_database = rocket_chat_mongodb_database -%}
{% else %}
{% set rocket_chat_mongodb_database = "rocketchat" -%}
{% endif %}
{% if rocket_chat_mongodb_use_tls == true %}
{% set rocket_chat_mongodb_use_tls = "?ssl=true" -%}
{% else %}
{% set rocket_chat_mongodb_use_tls = "?ssl=false" -%}
{% endif %} Should end up looking something like this in rocket_chat_mongodb_user: ~
rocket_chat_mongodb_pass: ~
rocket_chat_mongodb_creds:
"{{
((rocket_chat_mongodb_user is defined) and (rocket_chat_mongodb_pass is defined))
| ternary(rocket_chat_mongodb_user ~ ':' ~ rocket_chat_mongodb_pass ~ '@', omit)
}}"
rocket_chat_mongodb_database: rocketchat
rocket_chat_mongodb_use_tls: false
rocket_chat_mongodb_URI:
"{{ rocket_chat_mongodb_creds ~ rocket_chat_mongodb_server ~
':' ~ rocket_chat_mongodb_port ~ '/' ~ rocket_chat_mongodb_database ~
( rocket_chat_mongodb_use_tls | ternary('?ssl=true', omit) )
}}" Then you either just need to paste the string I have for You can also leave it so where not all of it is done inside a single env MONGO_URL="mongodb://{{ rocket_chat_mongodb_credentials ~ rocket_chat_mongodb_server }}:{{ rocket_chat_mongodb_port }}/{{ rocket_chat_mongodb_database ~ ( rocket_chat_mongodb_use_tls | ternary('?ssl=true',None) ) }}" Note:
In the end what I want to see more of is less duplicated code and more usage of the defaults file. Thanks! |
Forgot to address:
My present knowledge that I can recall of mongo isn't so great at the moment, but the general direction I would lean is:
|
- Explicitly define the mongodb upstart init conf path - Mongodb repo updates for 3.4 - Allow tuning of mongodb service name - New vars: - `rocket_chat_mongodb_service_name`: mongod (string) - `rocket_chat_mongodb_org_pkgs`: false (bool) - `rocket_chat_mongodb_org_version`: 3.4 (string) - Implement suggestions from #40 #50 - Allow fine-grained tuning of `MONGO_URL` inside service files - Configure `rocket_chat_mongodb_URI` with jinja2 logic - New vars: - `rocket_chat_mongodb_user`: ~ (string) - `rocket_chat_mongodb_password`: ~ (string) - `rocket_chat_mongodb_database`: rocketchat (string) - `rocket_chat_mongodb_use_tls`: false (bool) - `rocket_chat_mongodb_URI`: computed result - Move replSet task into mongodb.yml - Change idempotency of replSet command - Now actually check on the JSON output of the - Add MongoDB.org offical package install task for RHEL - Vaariabilize `rocket_chat_mongodb_config` for debian packages - Set the variable explicitly in the org packages task to match the official location - Fixes: #40 #50 #54 #71 Mongodb changes from @photoninger (Thanks also for #71 as a reference!) - Add mongodb_service_name to README - Variablize mongodb log to match service name Fixes: #71
- Explicitly define the mongodb upstart init conf path - Mongodb repo updates for 3.4 - Allow tuning of mongodb service name - New vars: - `rocket_chat_mongodb_service_name`: mongod (string) - `rocket_chat_mongodb_org_pkgs`: false (bool) - `rocket_chat_mongodb_org_version`: 3.4 (string) - Implement suggestions from RocketChat#40 RocketChat#50 - Allow fine-grained tuning of `MONGO_URL` inside service files - Configure `rocket_chat_mongodb_URI` with jinja2 logic - New vars: - `rocket_chat_mongodb_user`: ~ (string) - `rocket_chat_mongodb_password`: ~ (string) - `rocket_chat_mongodb_database`: rocketchat (string) - `rocket_chat_mongodb_use_tls`: false (bool) - `rocket_chat_mongodb_URI`: computed result - Move replSet task into mongodb.yml - Change idempotency of replSet command - Now actually check on the JSON output of the - Add MongoDB.org offical package install task for RHEL - Vaariabilize `rocket_chat_mongodb_config` for debian packages - Set the variable explicitly in the org packages task to match the official location - Fixes: RocketChat#40 RocketChat#50 RocketChat#54 RocketChat#71 Mongodb changes from @photoninger (Thanks also for RocketChat#71 as a reference!) - Add mongodb_service_name to README - Variablize mongodb log to match service name Fixes: RocketChat#71
TwizzyDizzy seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This PR refers to #40.
Alright, have a look at these commits... my remarks:
templates/mongod.conf.j2
to have the server even speak TLS. Do you have any thoughts on this? Not sure if this is a road one wants to go down, as it implicates a lot of choices and a decision tree that might not by trivial.Cheers
Thomas