Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
poc_irods
poc-irods
Commits
6aecc539
Commit
6aecc539
authored
Jan 22, 2021
by
viscapi
Browse files
Merge branch 'postgresql-systemd-improvement' into 'master'
Postgresql systemd improvement See merge request
!1
parents
c42647cb
a5d16129
Changes
2
Hide whitespace changes
Inline
Side-by-side
postgresql/tasks/systemd.yml
View file @
6aecc539
---
-
name
:
Set PGDATA environment variable on CentOS
7
lineinfile
:
path
:
/usr/lib/systemd/system/postgresql.service
regexp
:
'
^Environment=PGDATA='
line
:
'
Environment=PGDATA={{path_to_icat}}'
when
:
(ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7" and use_distribution_postgresql)
-
name
:
Set PGDATA environment variable on CentOS
7
lineinfile
:
path
:
/usr/lib/systemd/system/postgresql-{{ external_postgresql_version }}.service
regexp
:
'
^Environment=PGDATA='
line
:
'
Environment=PGDATA={{path_to_icat}}'
when
:
(ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7" and not use_distribution_postgresql)
-
name
:
Set PGDATA environment variable on CentOS
8
lineinfile
:
path
:
/usr/lib/systemd/system/postgresql.service
regexp
:
'
^Environment=PGDATA='
line
:
'
Environment=PGDATA={{path_to_icat}}'
when
:
(ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8" and use_distribution_postgresql)
-
name
:
Set PGDATA environment variable on CentOS
8
lineinfile
:
path
:
/usr/lib/systemd/system/postgresql-{{ external_postgresql_version }}.service
regexp
:
'
^Environment=PGDATA='
line
:
'
Environment=PGDATA={{path_to_icat}}'
when
:
(ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8" and not use_distribution_postgresql)
# Dynamically set some variables commonly used by this task group.
-
name
:
Setting facts for systemd operations.
vars
:
external_postgres_suffix
:
"
-{{
external_postgresql_version
}}"
# Suffix will be '-version', e.g. '-13' for postgresql v13.x.x, or '' (nothing) if we do use the version distributed by the standard repository.
suffix
:
"
{{
(
use_distribution_postgresql
==
false
)
|
ternary(external_postgres_suffix,
'')
}}"
set_fact
:
postgres_unit_file_name
:
"
postgresql{{
suffix
}}.service"
# This task will place an 'override' for the systemd unit file distributed by postgresql.
# Modifying the original unit file is not recomended as it is replaced with each update of postgresql.
#
# Its current purpose is to define the path to the data directory where the database's actual data will be on the system.
# cf. The template file.
-
name
:
"
Define
the
{{
postgres_unit_file_name
}}
override
file."
template
:
src
:
templates/postgresql.service.j2
dest
:
"
/etc/systemd/system/{{
postgres_unit_file_name
}}"
owner
:
root
group
:
wheel
mode
:
'
0644'
when
:
-
path_to_icat is defined
-
path_to_icat != None
-
path_to_icat | length >
0
-
name
:
Start postgresql service on CentOS
7
systemd
:
...
...
@@ -36,7 +34,7 @@
enabled
:
yes
when
:
(ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7" and use_distribution_postgresql)
-
name
:
Start postgresql-{{ postgresql_version }} service on CentOS
7
-
name
:
Start postgresql-{{
external_
postgresql_version }} service on CentOS
7
systemd
:
name
:
postgresql-{{ external_postgresql_version }}
state
:
started
...
...
postgresql/templates/postgresql.service.j2
0 → 100644
View file @
6aecc539
.include /usr/lib/systemd/system/{{ postgres_unit_file_name }}
[Service]
Environment=PGDATA={{ path_to_icat }}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment