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

add support for install in LXC containers #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 12 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
---
- name: check if inside container
command: grep -qa container=lxc /proc/1/environ
register: container_env
ignore_errors: yes

- name: set fact inside container
set_fact:
inside_container: "{% if container_env.rc == 0 %}True{% else %}False{% endif %}"

- name: enable overcommit in sysctl
sysctl:
name: vm.overcommit_memory
value: "1"
state: present
reload: yes
ignoreerrors: yes
when: redis_travis_ci is not defined
when:
- redis_travis_ci is not defined
- container_env.rc != 0

- name: compile redis
shell: umask 0022 && make -j{{ ansible_processor_cores|default(1) + 1 }}{{ ' 32bit' if redis_make_32bit|bool else '' }}
Expand Down
6 changes: 3 additions & 3 deletions templates/default/redis.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ OOMScoreAdjust={{ redis_oom_score_adjust }}
{% endif %}

UMask=007
PrivateTmp=yes
PrivateTmp={{ 'no' if inside_container else 'yes' }}
LimitNOFILE={{ redis_nofile_limit }}
PrivateDevices=yes
ProtectHome=yes
PrivateDevices={{ 'no' if inside_container else 'yes' }}
ProtectHome={{ 'no' if inside_container else 'yes' }}
ReadOnlyDirectories=/
ReadWriteDirectories=-{{ redis_dir }}
{% if redis_logfile != '""' %}
Expand Down
6 changes: 3 additions & 3 deletions templates/default/redis_sentinel.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ OOMScoreAdjust={{ redis_sentinel_oom_score_adjust }}
{% endif %}

UMask=007
PrivateTmp=yes
PrivateTmp={{ 'no' if inside_container else 'yes' }}
LimitNOFILE={{ redis_nofile_limit }}
PrivateDevices=yes
ProtectHome=yes
PrivateDevices={{ 'no' if inside_container else 'yes' }}
ProtectHome={{ 'no' if inside_container else 'yes' }}
ReadOnlyDirectories=/
ReadWriteDirectories=-{{ redis_sentinel_dir }}
{% if redis_sentinel_logfile != '""' %}
Expand Down