-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Rename st2mistral vars & Misc cosmetic improvements #94
Conversation
a2b7eca
to
5f4e848
Compare
da8bd52
to
7060d20
Compare
This could be important when user changes DB connection settings from DB1 to DB2 and we change mistral.conf only when new DB is 100% ready
Configure mistral after DB creation
So after playing a bit and taking closer look at
|
tags: st2mistral | ||
|
||
- name: Initiate database | ||
- name: Initiate mistral database | ||
become: yes | ||
become_user: postgres | ||
shell: psql < /etc/mistral/init_mistral_db.SQL |
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.
Here we have a problem when user will consider to change any of st2mistral_
database settings in future, - the SQL
script will not run twice. That means, new DB is not created.
We can workaround with additional lock files, but #95 should solve it in a right way.
@@ -55,9 +42,29 @@ | |||
- restart mistral | |||
tags: st2mistral | |||
|
|||
- name: Setup Mistral DB tables, etc | |||
- name: Make sure "Initiate mistral database" doesn't run twice |
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.
You're creating the file here, but I don't see where you're checking for the presence of the file in the previous task (i.e. no when
clause)
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.
See: creates: /etc/mistral/init_mistral_db.SQL.ansible.has.run
in previous task.
If file from the creates
exists, - the command won't be executed.
See: http://docs.ansible.com/ansible/shell_module.html for more info.
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.
Ah, okay I get it now.
- restart mistral | ||
tags: st2mistral | ||
|
||
- name: Setup mistral DB tables, etc |
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.
Same as above - don't currently see how this is idempotent, since there is no when
clause
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.
Similar example with creates
: https://github.com/StackStorm/ansible-st2/pull/94/files/2b9a44658672559fff187610578832c22a6c2a0c#r97388431
@@ -67,11 +74,19 @@ | |||
|
|||
- name: Register mistral actions | |||
become: yes | |||
shell: /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate && touch /etc/mistral/mistral-db-manage.upgrade.head.ansible.has.run | |||
shell: /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate && touch /etc/mistral/mistral-db-manage.populate.ansible.has.run |
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.
same
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.
We touch the file first, find: && touch /etc/mistral/mistral-db-manage.populate.ansible.has.run
and later in block don't execute it if touch
exists:
creates: /etc/mistral/mistral-db-manage.populate.ansible.has.run
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
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.
👍
@humblearner I just moved that So DB is created first and then we change the |
We renamed
mistral
->st2mistral
role for consistency with other packages we install via roles (st2
,st2web
), but forgot to do so for respective variables.This PR is a follow-up for #78 which actualizes variable names with a role name (it's good practice to prefix variable name with a role name).
mistral_version
->st2mistral_version
mistral_db
->st2mistral_db
mistral_db_username
->st2mistral_db_username
mistral_db_password
->st2mistral_db_password
Additionally tiny improvements:
mistral
service is enabled and running