Skip to content

Commit 8289f0b

Browse files
fix: use proper binary URL and add systemd unit
Signed-off-by: Anatoli Nicolae <an@thundersquared.com>
1 parent b037c92 commit 8289f0b

File tree

1 file changed

+39
-24
lines changed
  • mx1/ansible/roles/system/envoy/tasks

1 file changed

+39
-24
lines changed

mx1/ansible/roles/system/envoy/tasks/main.yml

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,47 @@
1010
set_fact:
1111
envoy_target_version: "{{ envoy_version | default(envoy_release.json.tag_name) }}"
1212

13-
- name: Download Envoy binary
13+
- name: Download and install Envoy binary
1414
get_url:
15-
url: "https://github.com/envoyproxy/envoy/releases/download/{{ envoy_target_version }}/envoy-{{ envoy_target_version | regex_replace('^v', '') }}-linux-x86_64.tar.gz"
16-
dest: /tmp/envoy.tar.gz
17-
register: download_result
18-
19-
- name: Extract Envoy binary
20-
unarchive:
21-
src: /tmp/envoy.tar.gz
22-
dest: /tmp/
23-
remote_src: yes
24-
when: download_result.changed
25-
26-
- name: Install Envoy binary
27-
copy:
28-
src: "/tmp/envoy-{{ envoy_target_version | regex_replace('^v', '') }}-linux-x86_64/bin/envoy"
15+
url: "https://github.com/envoyproxy/envoy/releases/download/{{ envoy_target_version }}/envoy-{{ envoy_target_version | regex_replace('^v', '') }}-linux-x86_64"
2916
dest: /usr/local/bin/envoy
3017
mode: '0755'
31-
remote_src: yes
32-
when: download_result.changed
3318

34-
- name: Clean up temporary files
19+
- name: Create Envoy config directory
3520
file:
36-
path: "{{ item }}"
37-
state: absent
38-
loop:
39-
- /tmp/envoy.tar.gz
40-
- "/tmp/envoy-{{ envoy_target_version | regex_replace('^v', '') }}-linux-x86_64"
41-
when: download_result.changed
21+
path: /etc/envoy
22+
state: directory
23+
mode: '0755'
24+
25+
- name: Create Envoy systemd service
26+
copy:
27+
dest: /etc/systemd/system/envoy.service
28+
content: |
29+
[Unit]
30+
Description=Envoy Proxy
31+
After=network.target
32+
33+
[Service]
34+
Type=simple
35+
ExecStart=/usr/local/bin/envoy -c /etc/envoy/envoy.yaml
36+
Restart=always
37+
User=root
38+
Group=root
39+
40+
[Install]
41+
WantedBy=multi-user.target
42+
mode: '0644'
43+
44+
- name: Reload systemd daemon
45+
systemd:
46+
daemon_reload: yes
47+
48+
- name: Enable Envoy service
49+
systemd:
50+
name: envoy
51+
enabled: yes
52+
53+
- name: Start Envoy service
54+
systemd:
55+
name: envoy
56+
state: started

0 commit comments

Comments
 (0)