This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pulp_redis: Allow to configure Unix Domain Socket
This commit ensures one can configure redis so it listens to unix domain socket (if wanted) rather than forcing it to listen on TCP socket. Benefits of this commit has been higlighted in previous PR[1]. Also, this commit introduces `pulp_redis_bind` to offer an expected experience for people using `pulp/pulp_installer` when it comes to configure network services (ie. `pulp_api_bind`, `pulp_content_bind`). fixes #6931 [1] #322
- Loading branch information
Showing
11 changed files
with
65 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 @@ | ||
Allow a user to use Unix Domain Socket (UDS) for the redis server. |
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
pulp_install_dir: '/usr/local/lib/pulp' | ||
pulp_user: pulp | ||
pulp_redis_bind: '127.0.0.1:6379' |
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 @@ | ||
--- | ||
- name: restart redis | ||
systemd: | ||
name: "{{ pulp_redis_server_name }}" | ||
state: restarted |
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,17 @@ | ||
--- | ||
- name: Set pulp_redis_host and pulp_redis_port fact | ||
set_fact: | ||
pulp_redis_host: '{{ pulp_redis_bind.split(":")[0] }}' | ||
pulp_redis_port: '{{ pulp_redis_bind.split(":")[1] }}' | ||
|
||
- name: Ensure Redis will listen on the specified TCP socket | ||
lineinfile: | ||
path: '{{ pulp_redis_conf_file }}' | ||
regexp: '{{ item.regexp }}' | ||
line: '{{ item.line }}' | ||
loop: | ||
- regexp: '^port ' | ||
line: 'port {{ pulp_redis_port }}' | ||
- regexp: '^bind ' | ||
line: 'bind {{ pulp_redis_host }}' | ||
notify: restart redis |
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,24 @@ | ||
--- | ||
- name: Configure pulp_redis_socket_file fact | ||
set_fact: | ||
pulp_redis_socket_file: '{{ pulp_redis_bind | replace("unix:", "") }}' | ||
|
||
- name: Ensure pulp is part of group redis | ||
user: | ||
name: '{{ pulp_user }}' | ||
groups: redis | ||
append: true | ||
|
||
- name: Ensure Redis will not listen on a TCP socket | ||
lineinfile: | ||
path: '{{ pulp_redis_conf_file }}' | ||
regexp: '{{ item.regexp }}' | ||
line: '{{ item.line }}' | ||
loop: | ||
- regexp: '^port ' | ||
line: 'port 0' | ||
- regexp: '^unixsocket ' | ||
line: 'unixsocket {{ pulp_redis_socket_file }}' | ||
- regexp: '^unixsocketperm ' | ||
line: 'unixsocketperm 775' | ||
notify: restart redis |
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
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
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
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ pulp_preq_packages: | |
- python3-devel | ||
|
||
pulp_redis_server_name: redis | ||
pulp_redis_conf_file: '/etc/redis.conf' |
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