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!
This commit is contained in:
Emi Matchu 2024-05-02 12:47:02 -07:00
parent 12764c44fc
commit 73c2d4327a

View file

@ -178,9 +178,9 @@
when: not ruby_dir.stat.exists when: not ruby_dir.stat.exists
- name: Add Ruby 3.3.0 to the global PATH, for developer convenience - name: Add Ruby 3.3.0 to the global PATH, for developer convenience
lineinfile: copy:
dest: /etc/profile dest: /etc/profile.d/ruby_path.sh
line: 'PATH="/opt/ruby-3.3.0/bin:$PATH" # Added by impress deploy setup script' content: PATH="/opt/ruby-3.3.0/bin:$PATH"
- name: Install system dependencies for impress's Ruby gems - name: Install system dependencies for impress's Ruby gems
apt: apt: