From 73c2d4327a581e4c9c846a41ade9f7e4d5083747 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 2 May 2024 12:47:02 -0700 Subject: [PATCH] Oops, don't have old Rubies in the PATH when deploying! Ahh right, this `lineinfile` trick has a gotcha: if we ever change the Ruby version, it injects the line into the file as a *new* line, instead of updating or removing the existing one. When poking at the content of `/etc/profile` to remove old versions of the line, I noticed that `/etc/profile.d` is a thing! We can drop a file into there and manage it more directly, instead. Let's do that! --- deploy/setup.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/setup.yml b/deploy/setup.yml index 0c4e22a3..e8af03ef 100644 --- a/deploy/setup.yml +++ b/deploy/setup.yml @@ -178,9 +178,9 @@ when: not ruby_dir.stat.exists - name: Add Ruby 3.3.0 to the global PATH, for developer convenience - lineinfile: - dest: /etc/profile - line: 'PATH="/opt/ruby-3.3.0/bin:$PATH" # Added by impress deploy setup script' + copy: + dest: /etc/profile.d/ruby_path.sh + content: PATH="/opt/ruby-3.3.0/bin:$PATH" - name: Install system dependencies for impress's Ruby gems apt: