Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiKhomik committed Dec 5, 2024
1 parent bf62e10 commit 2196093
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ansible1/roles/packages/tasks/install-from-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
apt:
name: "{{ ruby_build_packages }}"
state: present
when: ansible_os_family === 'Debian'
when: ansible_os_family == 'Debian'

- name: Ensure that /var/cache/ansible/ exists
file:
Expand All @@ -25,12 +25,12 @@
register: ruby_version_marker

- name: Download, extract and install ruby
when: not ruby_version_maker.stat.exists
when: not ruby_version_marker.stat.exists
block:
- name: Download ruby
get_url:
url: "{{ ruby_download_url }}"
dest: "{{ workspace }}/ruby-{{ ruby_version }}.tag.gz"
dest: "{{ workspace }}/ruby-{{ ruby_version }}.tar.gz"

- name: Extract ruby
unarchive:
Expand Down
9 changes: 9 additions & 0 deletions ansible1/roles/packages/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
become_user: "{{ ruby_install_gems_user }}"
with_items: "{{ ruby_install_gems }}"

# Install Bundler
- name: Install Bundler
gem:
name: bundler
version: "{{ bundler_version }}"
state: present
user_install: false
when: ruby_install_bundler

# Install Ruby on Rails
- name: Install Ruby on Rails
gem:
Expand Down
7 changes: 6 additions & 1 deletion ansible1/roles/packages/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
ruby_version: "3.3.5"
rails_version: "7.1.2"
bundler_version: "2.2.8"
puma_version: "5.6.9"
ruby_install_rails: true
ruby_install_from_source: true
ruby_install_bundler: true
__ruby_packages:
- ruby-full
- ruby-dev
Expand All @@ -23,5 +27,6 @@ __ruby_build_packages:
ruby_rubygems_package_name: rubygems
ruby_download_url: https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.5.tar.xz
workspace: /root
puma_version: "6.3.0"
ruby_install_puma: true
ruby_source_configure_command: ./configure --enable-shared
ruby_install_gems: []

0 comments on commit 2196093

Please sign in to comment.