fetsite installation
This commit is contained in:
6
tasks/fetsite.yml
Normal file
6
tasks/fetsite.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
- name: Install RVM
|
||||
include: 'rvm.yml'
|
||||
become: yes
|
||||
become_user: "{{ rvm1_user }}"
|
||||
|
||||
- name: Install ruby requirements
|
||||
command: '{{ rvm1_rvm }} requirements'
|
||||
changed_when: False
|
||||
when: rvm1_rubies
|
||||
|
||||
|
||||
- name: Install Ruby and Gems
|
||||
@@ -25,7 +31,47 @@
|
||||
become: yes
|
||||
become_user: "{{ rvm1_user }}"
|
||||
|
||||
- name: "deploying ruby sites"
|
||||
include_tasks: site.yml
|
||||
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
with_items: '{{ rvm1_rubies }}'
|
||||
when: rvm1_rubies
|
||||
|
||||
|
||||
- name: Install rubies
|
||||
command: '{{ rvm1_rvm }} install {{ item.item }} {{ rvm1_ruby_install_flags }}'
|
||||
when: rvm1_rubies and item.rc|default(0) != 0
|
||||
|
||||
@@ -1,66 +1,45 @@
|
||||
# Deploy a ruby site
|
||||
# item:
|
||||
# name: Seite
|
||||
# git:
|
||||
# repo: https://git_repository
|
||||
# dest: destination on server
|
||||
---
|
||||
|
||||
- debug:
|
||||
msg: "Seite: {{item.name}}"
|
||||
msg: "deploy ruby site: {{site.name}}"
|
||||
|
||||
- command: whoami
|
||||
register: whoami
|
||||
- command: echo "$PATH"
|
||||
register: out
|
||||
changed_when: false
|
||||
- debug: msg="{{ out.stdout }}"
|
||||
|
||||
|
||||
- debug: msg="{{ whoami.stdout }}"
|
||||
|
||||
|
||||
- name: "DIR"
|
||||
file:
|
||||
path: "{{item.git.dest}}"
|
||||
state: directory
|
||||
owner: "ruby"
|
||||
group: "ruby"
|
||||
|
||||
|
||||
- name: Clone GIT
|
||||
become_user: "ruby"
|
||||
- name: "cloning git repository from {{site.git.repo}}"
|
||||
git:
|
||||
repo: "{{item.git.repo}}"
|
||||
dest: "{{item.git.dest}}"
|
||||
repo: "{{site.git.repo}}"
|
||||
dest: "{{site.dest}}"
|
||||
|
||||
|
||||
- name: ruby init
|
||||
command: 'echo "$PATH"'
|
||||
become_user: "ruby"
|
||||
changed_when: false
|
||||
args:
|
||||
chdir: "{{item.git.dest}}"
|
||||
chdir: "{{site.dest}}"
|
||||
environment:
|
||||
PATH: "{{ rvm1_install_path }}/wrappers/default:{{ ansible_env.PATH }}"
|
||||
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 }}"
|
||||
|
||||
- name: ls
|
||||
command: ls .
|
||||
become_user: "ruby"
|
||||
args:
|
||||
chdir: "{{item.git.dest}}"
|
||||
register: out
|
||||
|
||||
- debug: msg="{{ out.stdout_lines }}"
|
||||
|
||||
- shell: ./initscript.sh
|
||||
become_user: "ruby"
|
||||
args:
|
||||
chdir: "{{item.git.dest}}"
|
||||
register: output
|
||||
when: not(item.ruby_init is undefined) and item.ruby_init
|
||||
|
||||
- debug:
|
||||
msg:"{{output}}"
|
||||
|
||||
- name: ruby init
|
||||
command: 'echo initscript.sh | /bin/bash --login'
|
||||
become_user: "ruby"
|
||||
args:
|
||||
chdir: "{{item.git.dest}}"
|
||||
register: output
|
||||
when: not(item.ruby_init is undefined) and item.ruby_init
|
||||
|
||||
|
||||
|
||||
- debug:
|
||||
msg:"{{output}}"
|
||||
- include_tasks: fetsite.yml
|
||||
when: not(site.ruby_init is undefined) and site.ruby_init
|
||||
|
||||
Reference in New Issue
Block a user