forked from theforeman/forklift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add external database role and pipeline
Signed-off-by: Eric D. Helms <ericdhelms@gmail.com>
- Loading branch information
Showing
4 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
- hosts: localhost | ||
vars_files: | ||
- vars/external_database.yml | ||
roles: | ||
- forklift | ||
|
||
- hosts: "{{ forklift_database_name }}" | ||
become: yes | ||
vars_files: | ||
- vars/external_database.yml | ||
roles: | ||
- role: forklift_versions | ||
scenario: "{{ pipeline_type }}" | ||
scenario_os: "{{ pipeline_os }}" | ||
scenario_version: "{{ pipeline_version }}" | ||
- role: postgresql | ||
|
||
- hosts: "{{ forklift_server_name }}" | ||
become: yes | ||
vars_files: | ||
- vars/external_database.yml | ||
roles: | ||
- role: forklift_versions | ||
scenario: "{{ pipeline_type }}" | ||
scenario_os: "{{ pipeline_os }}" | ||
scenario_version: "{{ pipeline_version }}" | ||
- role: foreman_server_repositories | ||
- role: etc_hosts | ||
- role: update_os_packages | ||
- role: foreman_installer | ||
foreman_installer_options_internal_use_only: | ||
- "--foreman-db-manage false" | ||
- "--foreman-db-host {{ forklift_database_name }}" | ||
- "--foreman-db-database foreman" | ||
- "--foreman-db-password foreman" | ||
- "--katello-candlepin-manage-db false" | ||
- "--katello-candlepin-db-host {{ forklift_database_name }}" | ||
- "--katello-candlepin-db-name candlepin" | ||
- "--katello-candlepin-db-password candlepin" | ||
- "--foreman-proxy-content-pulpcore-manage-postgresql false" | ||
- "--foreman-proxy-content-pulpcore-postgresql-host {{ forklift_database_name }}" | ||
- "--foreman-proxy-content-pulpcore-postgresql-db-name pulp" | ||
- "--foreman-proxy-content-pulpcore-postgresql-password pulp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
pipeline_type: katello | ||
pipeline_version: nightly | ||
pipeline_os: centos9-stream | ||
foreman_installer_scenario: katello | ||
server_box: | ||
box: "{{ pipeline_os }}" | ||
memory: 10240 | ||
ansible: | ||
variables: | ||
foreman_server_repositories_katello: true | ||
foreman_installer_disable_system_checks: true | ||
foreman_installer_scenario: katello | ||
foreman_installer_additional_packages: | ||
- "foreman-installer-katello" | ||
database_box: | ||
box: "{{ pipeline_os }}" | ||
memory: 4096 | ||
ansible: | ||
variables: | ||
postgresql_use_evr: true | ||
forklift_name: "pi-{{ pipeline_type }}-{{ pipeline_version }}-{{ pipeline_os }}-external-database" | ||
forklift_server_name: "pi-{{ pipeline_type }}-{{ pipeline_version }}-{{ pipeline_os }}-server" | ||
forklift_database_name: "pi-{{ pipeline_type }}-{{ pipeline_version }}-{{ pipeline_os }}-database" | ||
forklift_boxes: | ||
"{{ {forklift_server_name: server_box, forklift_database_name: database_box} }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- hosts: all | ||
become: true | ||
roles: | ||
- postgresql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
- name: 'Install postgres packages' | ||
yum: | ||
name: "{{ item }}" | ||
state: installed | ||
with_items: | ||
- postgresql-server | ||
- python-psycopg2 | ||
- postgresql-contrib | ||
|
||
- when: postgresql_use_evr | ||
block: | ||
- name: Include foreman server repositories | ||
include_role: | ||
name: katello_repositories | ||
|
||
- name: 'Install postgresql-evr packages' | ||
yum: | ||
name: postgresql-evr | ||
state: installed | ||
|
||
- name: 'Init PostgreSQL database' | ||
command: postgresql-setup initdb | ||
args: | ||
creates: /var/lib/pgsql/data/postgresql.conf | ||
|
||
- name: 'Deploy pg_hba.conf' | ||
copy: | ||
dest: /var/lib/pgsql/data/pg_hba.conf | ||
content: | | ||
# TYPE DATABASE USER ADDRESS METHOD | ||
# "local" is for Unix domain socket connections only | ||
local all all ident | ||
# IPv4 local connections: | ||
host all all 127.0.0.1/32 md5 | ||
# IPv4 remote connections: | ||
host all all 0.0.0.0/0 md5 | ||
# IPv6 local connections: | ||
host all all ::1/128 md5 | ||
force: yes | ||
mode: 0600 | ||
owner: postgres | ||
group: postgres | ||
|
||
- name: Set listen addresses to * | ||
lineinfile: | ||
dest: /var/lib/pgsql/data/postgresql.conf | ||
regexp: "^listen_addresses" | ||
line: "listen_addresses = '*'" | ||
state: present | ||
backup: yes | ||
|
||
- name: 'Ensure PostgreSQL is running' | ||
service: | ||
name: postgresql | ||
state: restarted | ||
enabled: yes | ||
|
||
- name: 'Add database user' | ||
become_user: postgres | ||
postgresql_user: | ||
state: present | ||
name: "foreman" | ||
password: "foreman" | ||
|
||
- name: 'Create Foreman database' | ||
become_user: postgres | ||
postgresql_db: | ||
state: present | ||
name: "foreman" | ||
owner: "foreman" | ||
|
||
- name: 'Add candlepin database user' | ||
become_user: postgres | ||
postgresql_user: | ||
state: present | ||
name: "candlepin" | ||
password: "candlepin" | ||
|
||
- name: 'Create Candlepin database' | ||
become_user: postgres | ||
postgresql_db: | ||
state: present | ||
name: "candlepin" | ||
owner: "candlepin" | ||
|
||
- name: 'Add pulp database user' | ||
become_user: postgres | ||
postgresql_user: | ||
state: present | ||
name: "pulp" | ||
password: "pulp" | ||
|
||
- name: 'Create Pulp database' | ||
become_user: postgres | ||
postgresql_db: | ||
state: present | ||
name: "pulp" | ||
owner: "pulp" |