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: common_basic_packages:
- curl - curl
- emacs-nox - emacs-nox
- ncurses-term
- git - git
- htop - htop
- iputils-ping - iputils-ping

View File

@@ -1,10 +1,15 @@
--- ---
common_aliases:
- "root: bofh@fet.at" rvm1_rvm_check_for_updates: False
common_hostname: False
common_apt: True ruby_sites:
common_rsyslog: False - name: "Fetsite"
common_resolvconf: True git:
common_resolvconf_nameservers:[ "192.168.0.1", "8.8.8.8"] repo: "/mnt/fetsite"
common_basic_packages: dest: "/srv/fetsite/fetsite"
- curl 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] [ruby]
test01 #test01
[test_common] test03
test02

View File

@@ -4,6 +4,12 @@ ruby_sites:
git: git:
repo: "/mnt/intern" repo: "/mnt/intern"
dest: "/srv/intern/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" # 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: - debug:
msg: "Seite: {{item.name}}" msg: "deploy ruby site: {{item.name}}"
- command: whoami - command: whoami
register: whoami register: whoami
changed_when: false changed_when: false
- debug: msg="{{ whoami.stdout }}" - debug: msg="{{ whoami.stdout }}"
- name: "create directory for {{item.name}}"
- name: "DIR"
file: file:
path: "/srv/intern" path: "{{item.git.dest}}"
state: directory state: directory
owner: "ruby" owner: "ruby"
group: "ruby" group: "ruby"
- name: Clone GIT - name: "cloning git repository from {{item.git.repo}}"
become_user: "ruby" become_user: "ruby"
git: git:
repo: "{{item.git.repo}}" repo: "{{item.git.repo}}"
dest: "{{item.git.dest}}" 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 become: true
roles: roles:
- testuser - testuser
- common - common
- rvm1-ansible - rvm1-ansible
- ruby_sites
- hosts: test_common - hosts: test_common
sudo: True sudo: True
roles: roles:

View File

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