Skip to content

Commit

Permalink
deploy: Install Redis, listen only on Nexodus VPC
Browse files Browse the repository at this point in the history
Signed-off-by: Russell Bryant <[email protected]>
  • Loading branch information
russellb committed Mar 16, 2024
1 parent 5ef3319 commit 1626a82
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deploy/ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ ansible-playbook -i inventory.txt -e @secrets.enc --ask-vault-pass deploy-bot.ym
```console
ansible-playbook -i inventory -e @secrets.enc --ask-vault-pass deploy-nexodus.yml
```

## Install Redis

Install Redis and make it listen only on the Nexodus VPC.

```console
ansible-playbook -i inventory -e @secrets.enc --ask-vault-pass deploy-redis.yml
```
5 changes: 5 additions & 0 deletions deploy/ansible/deploy-redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- name: Deploy Redis
hosts: labNodes
roles:
- role: redis
become: true
Empty file.
35 changes: 35 additions & 0 deletions deploy/ansible/redis/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
- name: Install redis
ansible.builtin.dnf:
name: redis
state: present
become: true

- name: Update redis config to load redis.local.conf
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
line: 'include /etc/redis/redis.local.conf'
become: true

- name: Get Nexodus Tunnel IP (v4)

Check failure on line 14 in deploy/ansible/redis/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ansible

command-instead-of-shell

Use shell only when shell functionality is required.

Check failure on line 14 in deploy/ansible/redis/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ansible

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: nexctl nexd get tunnelip
register: nexodus_tunnelip_v4
become: true

- name: Get Nexodus Tunnel IP (v6)

Check failure on line 19 in deploy/ansible/redis/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ansible

command-instead-of-shell

Use shell only when shell functionality is required.

Check failure on line 19 in deploy/ansible/redis/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ansible

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: nexctl nexd get tunnelip --ipv6
register: nexodus_tunnelip_v6
become: true

- name: Generate redis.local.conf

Check failure on line 24 in deploy/ansible/redis/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ansible

risky-file-permissions

File permissions unset or incorrect.
ansible.builtin.template:
src: redis/templates/redis.local.conf.j2
dest: /etc/redis/redis.local.conf
become: true

- name: Start redis systemd service
ansible.builtin.systemd:
name: redis
state: started
enabled: true
become: true
2 changes: 2 additions & 0 deletions deploy/ansible/redis/templates/redis.local.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bind {{ nexodus_tunnelip_v4.stdout }} {{ nexodus_tunnelip_v6.stdout }}
protected-mode no

0 comments on commit 1626a82

Please sign in to comment.