generated from ita-social-projects/DevTemplate
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4a224d
commit 65ff8b4
Showing
7 changed files
with
247 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,6 @@ | |
become_method: sudo | ||
become_user: root | ||
roles: | ||
# - packages | ||
- packages | ||
- postgresql | ||
- redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
|
||
- name: Detect rubies | ||
command: '{{ rvm1_rvm }}' | ||
register: rvm_list_strings | ||
changed_when: False | ||
|
||
- name: Install rubies | ||
command: '{{ rvm1_rvm }} install {{ item }} {{ rvm1_ruby_install_flags }}' | ||
loop: '{{ rvm1_rubies | difference(rvm_list_strings.stdout_lines) }}' | ||
|
||
- name: Detect default ruby version | ||
command: '{{ rvm1_rvm }} alias list default' | ||
changed_when: False | ||
register: detect_default_ruby_version | ||
|
||
- name: Select default ruby | ||
command: '{{ rvm1_rvm }} alias create default {{ rvm1_default_ruby_version }}' | ||
when: detect_default_ruby_version.stdout|default() == '' or | ||
rvm1_default_ruby_version not in detect_default_ruby_version.stdout | ||
|
||
- name: Detect installed ruby patch number | ||
shell: > | ||
{{ rvm1_rvm }} list strings | grep {{ item }} | tail -n -1 | ||
with_items: '{{ rvm1_rubies }}' | ||
changed_when: False | ||
register: ruby_patch | ||
check_mode: no | ||
|
||
- name: Install bundler if not installed | ||
shell: > | ||
ls {{ rvm1_install_path }}/wrappers/{{ item.stdout }} | ||
| if !grep "^bundler" ; then {{ rvm1_install_path }}/wrappers/{{ item.stdout }}/gem install bundler ; fi | ||
args: | ||
creates: '{{ rvm1_install_path }}/wrappers/{{ item.stdout }}/bundler' | ||
with_items: '{{ ruby_patch.results }}' | ||
when: rvm1_bundler_install | ||
register: bundler_install | ||
changed_when: '"Successfuly installed bundler" in bundler_install.stdout' | ||
|
||
- name: Symlink ruby related binaries on the system path | ||
file: | ||
state: 'link' | ||
src: '{{ rvm1_install_path }}/wrappers/default/{{ item }}' | ||
dest: '{{ rvm1_symlink_to }}/{{ item }}' | ||
owner: '{{ root_user }}' | ||
group: '{{ root_group }}' | ||
when: not '--user-install' in rvm1_install_flags and rvm1_symlink | ||
with_items: '{{ rvm1_symlink_binaries }}' | ||
|
||
- name: Symlink bundler binaries on the system path | ||
file: | ||
state: 'link' | ||
src: '{{ rvm1_install_path }}/wrappers/default/{{ item }}' | ||
dest: '{{ rvm1_symlink_to }}/{{ item }}' | ||
owner: '{{ root_user }}' | ||
group: '{{ root_group }}' | ||
when: not '--user-install' in rvm1_install_flags and rvm1_bundler_install and rvm1_symlink | ||
with_items: '{{ rvm1_symlink_bundler_binaries }}' | ||
|
||
- name: Delete ruby if relevant | ||
command: '{{ rvm1_rvm }} remove {{ rvm1_delete_ruby: }}' | ||
register: rvm_delete_command | ||
changed_when: "'#removing' in rvm_delete_command.stdout" | ||
when: rvm1_delete_ruby is defined and rvm1_delete_ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
|
||
- name: Detect rvm binary | ||
stat: path='{{ rvm1_rvm }}' | ||
register: rvm_binary | ||
|
||
- name: Detect rvm installer | ||
stat: path='{{ rvm1_temp_download_path }}/rvm-installer.sh' | ||
register: rvm_installer | ||
|
||
- name: Detect current rvm version | ||
command: '{{ rvm1_rvm }} version' | ||
changed_when: False | ||
register: rvm_current_version | ||
when: rvm_binary.stat.exists | ||
|
||
- name: Install rvm installer | ||
get_url: | ||
url: '{{ rvm1_rvm_latest_installer }}' | ||
dest: '{{ rvm1_temp_download_path }}/rvm-installer.sh' | ||
mode: 0755 | ||
when: not rvm_installer.stat.exists | ||
|
||
- name: Import GPG keys from keyservers | ||
shell: 'gpg --batch --keyserver {{ item }} --recv-keys {{ rvm1_gpg_keys }}' | ||
changed_when: False | ||
check_mode: False | ||
with_items: '{{ rvm1_gpg_key_servers }}' | ||
register: gpg_import | ||
when: not ansible_check_mode and rvm1_gpg_keys != '' and (gpg_import is not defined or gpg_import.rc != 0) | ||
ignore_errors: True | ||
|
||
- name: Was GPG import from keyservers succesfull? | ||
set_fact: gpg_imported_from={{ item.item }} | ||
when: "'rc' in item and item.rc == 0" | ||
with_items: "{{ gpg_import.results }}" | ||
|
||
- name: Import GPG keys from rvm.io, if keyservers failed | ||
shell: 'curl -sSL https://rvm.io/{{ item }} | gpg --batch --import -' | ||
with_items: | ||
- mpapis.asc | ||
- pkuczynski.asc | ||
when: not ansible_check_mode and rvm1_gpg_keys != '' and gpg_imported_from is not defined | ||
|
||
- name: Install rvm | ||
shell: > | ||
/usr/bin/env bash {{ rvm1_temp_download_path }}/rvm-installer.sh {{ rvm1_rvm_version }} | ||
--path {{ rvm1_install_path }} {{ rvm1_install_flags }} | ||
when: not rvm_binary.stat.exists | ||
|
||
- name: Update rvm | ||
shell: '{{ rvm1_rvm }} get {{ rvm1_rvm_version }} && {{ rvm1_rvm }} reload' | ||
changed_when: False | ||
when: rvm_binary.stat.exists and rvm1_rvm_check_for_updates | ||
|
||
- name: Configure rvm | ||
command: '{{ rvm1_rvm }} autolibs {{ rvm1_autolib_mode }}' | ||
when: not rvm_binary.stat.exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters