jfrog / JFrog-Cloud-Installers

Template to deploy Artifactory Enterprise cluster.
Apache License 2.0
78 stars 139 forks source link

[ansible/postgres] RHEL 7.8 - ''postgres_server_initdb_become'' is undefined' #58

Closed wdrury-uk closed 3 years ago

wdrury-uk commented 3 years ago

Hi

Using collection - jfrog.installers:1.1.2'

Trying to use collection on a local virtualbox lab and on our RHEL 7.8 VM install runs to the initialize PostgresSQL database cluster" task then errors as below.

TASK [jfrog.installers.postgres : initialize PostgreSQL database cluster] ****************************************************
task path: /root/.ansible/collections/ansible_collections/jfrog/installers/roles/postgres/tasks/main.yml:33
fatal: [postgres]: FAILED! =>
  msg: 'The field ''become'' has an invalid value, which includes an undefined variable. The error was: ''postgres_server_initdb_become'' is undefined'

On executing with -vv verbose I can see the variables being created by the collections postgres role as follows:

TASK [jfrog.installers.postgres : define distribution-specific variables] ****************************************************
task path: /root/.ansible/collections/ansible_collections/jfrog/installers/roles/postgres/tasks/main.yml:2
ok: [postgres] => changed=false
  ansible_facts:
    postgres_server_cmd_initdb: /usr/pgsql-{{ postgres_server_version }}/bin/postgresql{{ postgres_server_pkg_version }}-setup initdb -D
    postgres_server_config_data_directory: null
    postgres_server_config_external_pid_file: null
    postgres_server_config_hba_file: null
    postgres_server_config_ident_file: null
    postgres_server_config_location: '{{ postgres_server_data_location }}'
    postgres_server_data_location: /var/lib/pgsql/{{ postgres_server_version }}/data
    postgres_server_service_name: postgresql-{{ postgres_server_version }}
  ansible_included_var_files:
  - /root/.ansible/collections/ansible_collections/jfrog/installers/roles/postgres/vars/RedHat.yml

As you can see it appears the required _postgres_server_initdb_become var is missing from the /postgres/vars/RedHat.yml_ although I have checked and it is included in the _RedHatpg-9.6.yml vars file. Should this one have been used and pulled through the play instead or aswell?

chukka commented 3 years ago

Thanks @wdrury-uk for reporting , we currently support ubuntu only, we are planning to support RHEL, Centos 7.x /8.x in upcoming weeks (mostly next month)

Heads up , we are planning to support (default ) postgresql-12 in upcoming releases

Would you mind raising this change as Pull Request ?

wdrury-uk commented 3 years ago

@chukka thanks for the update.

The reason we are moving to use this collection was to gain a standard build across all our JFrog Product, Artifactory, Xray and Mission Control. One key item is Postgres being v11 as this is the single common version JFrog support based on their system requirements matrix across those 3 products and as an Enterprise we must have one consistent version for replication setup, support and patching purposes.

Whats the reasoning to jump/only support Postgres v12 with the collection?

As for a PR be happy but Im not as postgres SME and not aware how to fix the above error. Its seems for #36 is the same issue from September and not yet been resolved, is their no planned fix for this?

chukka commented 3 years ago

@wdrury-uk We are shipping all our installers with postgresql 12.x going forward, We already support 12.x in our helm charts . This 12.x support for ansible will happen in next month release (along with #36 Fix and system requirements document update)

chukka commented 3 years ago

@wdrury-uk Also, we are planning to support distribution and mission-control playbooks (roles) in upcoming release

wdrury-uk commented 3 years ago

Thanks @chukka.

Can you prove a manual fix here I can update my local copy of the collection to progress with my Artifactory build as waiting a month for a release to fix #36 bug is long time in DevOps world :)

chukka commented 3 years ago

@wdrury-uk Workaround till we release officially :

define variable - postgres_server_initdb_become as an extra variable and set the value to true

Also, Provided manual workaround for #36 ,

wdrury-uk commented 3 years ago

Thanks I have made that fix in the postgres role defaults.yml. I will use the fix you have provided in issue #36.

wdrury-uk commented 3 years ago

Is there an update please as new version of the collection advised on my other issues was December 2020. Whats the new ETA of the next collection version fixing this issue?

chukka commented 3 years ago

please see comments in #57

wdrury-uk commented 3 years ago

Thanks @chukka for the update. We will plan our next internal platform release to coincide few week sprint. Looking forward to the improvements.