This commit is contained in:
Andreas Stephanides
2017-11-20 18:50:18 +01:00
parent a8c7bdb4c7
commit 94a7827cf2
3 changed files with 85 additions and 0 deletions

15
defaults/rubysite.yml Normal file
View File

@@ -0,0 +1,15 @@
ruby_sites:
- name: "Seite 1"
become_user: "ruby"
git:
repo: "/mnt/intern"
dest: "/srv/intern/intern"
- name: "Fetsite"
become_user: "ruby"
git:
repo: "/mnt/fetsite"
dest: "/srv/fetsite/fetsite"
ruby_init: true
# repo: "https://github.com/kbroman/simple_site"

View File

@@ -25,3 +25,7 @@
become: yes
become_user: "{{ rvm1_user }}"
- name: "deploying ruby sites"
include_tasks: site.yml
with_items: "{{ruby_sites}}"

66
tasks/site.yml Normal file
View File

@@ -0,0 +1,66 @@
---
- debug:
msg: "Seite: {{item.name}}"
- command: whoami
register: whoami
changed_when: false
- debug: msg="{{ whoami.stdout }}"
- name: "DIR"
file:
path: "{{item.git.dest}}"
state: directory
owner: "ruby"
group: "ruby"
- name: Clone GIT
become_user: "ruby"
git:
repo: "{{item.git.repo}}"
dest: "{{item.git.dest}}"
- name: ruby init
command: 'echo "$PATH"'
become_user: "ruby"
args:
chdir: "{{item.git.dest}}"
register: out
- 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}}"