This commit is contained in:
Andreas Stephanides
2017-12-08 08:54:53 +01:00
parent 7de8536297
commit 63fd99277b
7 changed files with 83 additions and 25 deletions

View File

@@ -27,6 +27,7 @@ common_vim_default: False
common_basic_packages:
- curl
- emacs-nox
- ncurses-term
- git
- htop
- iputils-ping

View File

@@ -1,10 +1,15 @@
---
common_aliases:
- "root: bofh@fet.at"
common_hostname: False
common_apt: True
common_rsyslog: False
common_resolvconf: True
common_resolvconf_nameservers:[ "192.168.0.1", "8.8.8.8"]
common_basic_packages:
- curl
rvm1_rvm_check_for_updates: False
ruby_sites:
- name: "Fetsite"
git:
repo: "/mnt/fetsite"
dest: "/srv/fetsite/fetsite"
ruby: 2.1.0
gemset: fetsite
ruby_init: true
script: ruby_fetsite
# repo: "https://github.com/kbroman/simple_site"

View File

@@ -1,4 +1,3 @@
[test_ruby]
test01
[test_common]
test02
[ruby]
#test01
test03

View File

@@ -4,6 +4,12 @@ ruby_sites:
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

@@ -1,26 +1,69 @@
# 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: {{item.name}}"
- command: whoami
register: whoami
changed_when: false
- debug: msg="{{ whoami.stdout }}"
- name: "DIR"
- name: "create directory for {{item.name}}"
file:
path: "/srv/intern"
path: "{{item.git.dest}}"
state: directory
owner: "ruby"
group: "ruby"
- name: Clone GIT
- name: "cloning git repository from {{item.git.repo}}"
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}}"

View File

@@ -1,10 +1,9 @@
- hosts: test_ruby
- hosts: ruby
become: true
roles:
- testuser
- common
- rvm1-ansible
- ruby_sites
- hosts: test_common
sudo: True
roles:

View File

@@ -14,8 +14,13 @@
- backupclient
- hosts: ruby
user: root
become: False
become: true
roles:
- common
- rvm1-ansible
- hosts: test_common
sudo: True
roles:
- common