-
Notifications
You must be signed in to change notification settings - Fork 1
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
PostgreSQL integration #11
Conversation
Post Scriptum: I struggled a lot with debconf sympa parameters (see #4). Particularly, it seems that In your initial code |
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.
Looks good already, I have to test it though.
Could you also please add the 2 new variables to the documentation.
Have you tested the postgresql capitalization for the config file? Can we transform it to a lowercase string?
tasks/postgresql.yml
Outdated
- name: check if postgres is installed | ||
assert: | ||
that: ansible_facts.packages['postgresql'] is defined | ||
fail_msg: "No PostgreSQL pachage found. We stop, because we can't install sympa without its database. Sorry." |
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.
typo
tasks/mysql.yml
Outdated
ansible_facts.packages['mysql-server'] is defined or | ||
ansible_facts.packages['mariadb-server-10.1'] is defined | ||
## The last condition could be replaced by a jinja2 json_query filter to match any version | ||
fail_msg: "No MySQL pachage found. We stop, because we can't install sympa without its database. Sorry." |
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.
typo
tasks/postgresql.yml
Outdated
|
||
## Debconf keys for sympa database | ||
|
||
- name: Definir opciones debconf de sympa, relativas a la base PostgreSQL |
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.
English please :)
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.
Sorry... copy/paste... :)
tasks/main.yml
Outdated
## set the database type | ||
- { name: 'sympa', question: 'sympa/database-type', value: '{{ sympa_db_type }}' , vtype: select } | ||
## Configure the database at sympa installation with dbconfig | ||
- { name: 'sympa', question: 'sympa/dbconfig-install', value: 'true' , vtype: boolean } |
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.
do we want this setting? Arent we configuring the database on our own
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.
I tried again: for PostgreSQL, when I set this to false
, sympa installation fails with the message:
Database sympa defined in sympa.conf has not the right structure or is unreachable. verify db_xxx parameters in sympa.conf
(and I tried again with postgresql or PostgreSQL for sympa parameter db_type, and that's the same).
For MySQL, when I tried yesterday there was no difference wether I put true or false. I'll try to figure out what is the difference between PostgreSQL and MySQL installation.
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.
I'm too puzzled with this dbconfig parameter. I think my initial interpretation was right: seeing sympa.conf
file, sympa tries an upgrade but, with PostreSQL, fails when running:
# /usr/lib/sympa/bin/sympa.pl --health_check
One strange thing is that I don't find any reference to db_passwd
in database drivers code. dbconfig
must do something that I don't identify, that solves this issue.
In order to avoid staying stucked, I propose you to set sympa/dbconfig-install
to true
for PostgreSQL and to maintain it set to false
for MySQL.
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.
Possible solution here. I'll test again.
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.
Possible solution here. I'll test again.
Eureka! Yes, it did!
@@ -113,4 +117,5 @@ sympa_default_home: home | |||
sympa_edit_list: owner | |||
sympa_ldap_force_canonical_email: 1 | |||
sympa_review_page_size: 25 | |||
sympa_webserver_type: Other # 'Other' or 'Apache 2' |
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.
lets use lowercase strings without a space
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.
Well, this variables is there to set a debconf parameter of select
type. When you install sympa manually, and after checking the debconf db with debconf-get-selections
it clearly proposes "Other" and "Apache 2".
I did some test, pre-setting the parameter with:
echo "sympa wwsympa/webserver_type select <value>" | debconf-set-selections
trying with <value>
set to Other
, other
, apache2
, Apache 2
, etc.
Without changing debconf priorities, when setting the value to Other
it silently preserves this value. When setting other values, it silently overwrites to the default value Apache 2
.
So I think that there, we have to stick to the exact spelling proposed for the two debconf select
options.
BTW, I struggled a lot with sympa debconf parameter. Sympa has a quite peculiar behaviour: most of the parameters are low o medium priority (so they aren't asked for), several are "internal", and most of all, they seem to be heavily overwritten at installation with default values, eventually built from linux hostname.
loop: | ||
## Set the sympa database password | ||
- { name: 'sympa', question: 'sympa/pgsql/app-pass', value: '{{ sympa_db_password | mandatory }}' , vtype: password } | ||
... |
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.
what are those dots for?
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.
It's YAML syntax for the end of a YAML section. It's not needed by Ansible, but I prefer to stick to the upstream syntax over Ansible pidgin.
tasks/postgresql.yml
Outdated
--- | ||
## PostgreSQL installation and configuration for sympa | ||
|
||
- name: check PostgreSQL installation |
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.
Please start with a capital Letter
tasks/mysql.yml
Outdated
package_facts: | ||
manager: auto | ||
|
||
- name: check if MySQL is installed |
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.
Please start with a capital letter
Good! No hurry..
Right! (going to bed I realized I forgot to update the README... :)
I sticked to sympa documentation, considering also that letter case matters in Perl. However, I just tried with |
PostgreSQL or postgresql? My colleague @santiagomr tackles me arguing that proper names start with a capital case letter. And PostgreSQL project itself uses this ElephantC... sorry CamelCase wording. On another hand, Debian packages' names are all lower case, and I understand the principle you propose to use only lower case in variable values. So I propose you: let's use lower case (and no space) to refer to packages and, as far as possible, for variable values, but accept capital letters when refering to a proper name. Do you agree? |
…debconf parameter
name: | ||
- debconf | ||
- debconf-utils | ||
state: latest |
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.
I added this requirements' check, as suggested by Ansible documentation, even if it seems to work without debconf-utils
package.
614368f
to
ef2b37c
Compare
Well, despite the fact that on the first run of the playbook It works ok with lowercase
This |
1077f85
to
e0ec6ac
Compare
…, should close PR stuvusIT#11, v0.2.1-pr11
So precise spelling is clearly needed, as part of Perl code. According to documentation (PosgreSQL and MySQL), |
I think I'm done with this PR. Whenever you can review it, I have more proposals for you. If you want, I can squash my commits, eventually preserving the versioned ones. |
0ef76c0
to
2b5a25e
Compare
As previously discussed, this PR with PostgreSQL option for the sympa database.
As initially in our code we install Postgres in the role itself, in order to act similarly for pgsql and mysql, I added a flag that gives the option to install the database package within the role itself or outside. And, by the way, I added some requirements checks.
As far as tested, all the four options work, meaning that the role doesn't fail and let Sympa installed and running, with its database configured. However, as the role doesn't configure Apache with Sympa web interface, I couldn't fully test yet all functionalities. It would be good if you could test also.
I will be working in the integration of Apache configuration for Sympa, with robots and other features.
Also, it seems to me that the role still makes some assumptions about the host, particularly the presence of postfix or other sendmail-like MTA. I will be also working on it, as well as DKIM integration.