Skip to content
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

Fix/#111 #112

Merged
merged 3 commits into from
May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions roles/deployment/databases/tasks/postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@

---

- name: Ensure psycopg2 is installed
package:
name: "{{ ((hostvars[item]['ansible_os_family'] == 'RedHat') and (hostvars[item]['ansible_distribution_major_version'] == '7')) | ternary('python-psycopg2', 'python3-psycopg2') }}"
with_items: "{{ databases | json_query('*.host') | unique }}"
delegate_to: "{{ item }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be run as a task vs an inventory group. Why not modify cloudera.cluster.infrastructure.rdbms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is only useful if cloudera.cluster.infrastructure.rdbms is not run
psycopg2 is already installed in cloudera.cluster.infrastructure.rdbms

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dug into this a bit more; this application pattern is rife throughout this role, for better or worse.

connection: ssh
when: item in groups.db_server

- name: Create database roles
postgresql_user:
name: "{{ databases[item].user }}"
Expand Down