add site
This commit is contained in:
15
defaults/rubysite.yml
Normal file
15
defaults/rubysite.yml
Normal 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"
|
||||
@@ -24,4 +24,8 @@
|
||||
include: 'rubies.yml'
|
||||
become: yes
|
||||
become_user: "{{ rvm1_user }}"
|
||||
|
||||
- name: "deploying ruby sites"
|
||||
include_tasks: site.yml
|
||||
with_items: "{{ruby_sites}}"
|
||||
|
||||
66
tasks/site.yml
Normal file
66
tasks/site.yml
Normal 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}}"
|
||||
Reference in New Issue
Block a user