carve out fetsite

This commit is contained in:
2018-02-25 12:55:35 +01:00
4 changed files with 30 additions and 69 deletions

View File

@@ -4,7 +4,7 @@
# The last ruby listed will be set as the default ruby # The last ruby listed will be set as the default ruby
rvm1_rubies: rvm1_rubies:
- '2.1.0' - '2.1.0'
- '2.3.1'
# Install bundler # Install bundler
rvm1_bundler_install: True rvm1_bundler_install: True

View File

@@ -10,6 +10,7 @@
ssh_key_bits: 4096 ssh_key_bits: 4096
ssh_key_file: .ssh/id_rsa ssh_key_file: .ssh/id_rsa
- name: install rvm prerequires - name: install rvm prerequires
apt: pkg="{{ item }}" cache_valid_time=3600 update_cache=yes state=present apt: pkg="{{ item }}" cache_valid_time=3600 update_cache=yes state=present
with_items: "{{ ruby_req_packages }}" with_items: "{{ ruby_req_packages }}"
@@ -20,12 +21,37 @@
become: yes become: yes
become_user: "{{ rvm1_user }}" become_user: "{{ rvm1_user }}"
- name: Install ruby requirements #- name: Install ruby requirements
command: '{{ rvm1_rvm }} requirements' # command: '{{ rvm1_rvm }} install requirements'
# changed_when: False
# when: rvm1_rubies
- name: Install rubies
command: '/home/{{ rvm1_user }}/.rvm/bin/rvm install requirements'
when: rvm1_rubies
- name: Detect if rubies are installed
command: '/home/{{ rvm1_user }}/.rvm/bin/rvm {{ item }} do true'
changed_when: False changed_when: False
failed_when: False
register: detect_rubies
with_items: '{{ rvm1_rubies }}'
when: rvm1_rubies when: rvm1_rubies
- name: remove rvm prerq
apt: pkg="libssl-dev" state=absent
- name: remove rvm prerq
apt: pkg="libssl1.0-dev" state=present
#- name: Install rubies
# command: '/home/{{ rvm1_user }}/.rvm/bin/rvm install {{ item.item }} {{ rvm1_ruby_install_flags }}'
# when: rvm1_rubies and item.rc|default(0) != 0
# with_items: '{{ detect_rubies.results }}'
- name: Install Ruby and Gems - name: Install Ruby and Gems
include: 'rubies.yml' include: 'rubies.yml'
become: yes become: yes
@@ -33,44 +59,6 @@
- name: "create directory for {{item.name}}"
file:
path: "{{item.dest}}"
state: directory
owner: "{{ rvm1_user }}"
group: "{{ rvm1_user }}"
with_items: "{{ruby_sites}}"
- name: Template for InitScript
template:
src: ruby_fetsite.j2
dest: "{{site.dest}}/../{{site.script}}"
owner: "{{ rvm1_user }}"
group: "{{ rvm1_user }}"
mode: "u=rwx,g=rwx,o=r"
when: not(site.script is undefined)
with_items: "{{ruby_sites}}"
loop_control:
loop_var: site
- name: Deploying sites
include: site.yml
become: yes
become_user: "{{ rvm1_user }}"
with_items: "{{ruby_sites}}"
loop_control:
loop_var: site

View File

@@ -30,16 +30,3 @@
PATH: "{{ rvm1_install_path }}/wrappers/default:{{ ansible_env.PATH }}" PATH: "{{ rvm1_install_path }}/wrappers/default:{{ ansible_env.PATH }}"
register: out register: out
- name: run_initscript
command: '../{{site.script}}'
args:
chdir: "{{site.dest}}"
register: out
environment:
PATH: "{{ rvm1_install_path }}/bin:{{ rvm1_install_path }}/wrappers/ruby-{{site.ruby}}@{{site.gemset}}:{{ ansible_env.PATH }}"
- debug: msg="{{ out.stdout_lines }}"
- include_tasks: fetsite.yml
when: not(site.ruby_init is undefined) and site.ruby_init

View File

@@ -1,14 +0,0 @@
#!/bin/bash
echo "sdf"
echo "{{site}}"
source ~/.rvm/scripts/rvm
source $({{rvm1_rvm}} {{site.ruby}} do rvm gemset create {{site.gemset}})
source $({{rvm1_rvm}} {{site.ruby}}@{{site.gemset}} do rvm env --path)
which ruby
gem install bundler
bundle install
rvm gemset list
ruby -v
#ruby -v