diff --git a/group_vars/all b/group_vars/all index 3a0ca7a..5aa6e13 100644 --- a/group_vars/all +++ b/group_vars/all @@ -27,6 +27,7 @@ common_vim_default: False common_basic_packages: - curl - emacs-nox + - ncurses-term - git - htop - iputils-ping diff --git a/group_vars/ruby b/group_vars/ruby index c75bcf3..c45257c 100644 --- a/group_vars/ruby +++ b/group_vars/ruby @@ -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" \ No newline at end of file diff --git a/hosts/test_andi b/hosts/test_andi index d52592e..e6231d1 100644 --- a/hosts/test_andi +++ b/hosts/test_andi @@ -1,4 +1,3 @@ -[test_ruby] -test01 -[test_common] -test02 \ No newline at end of file +[ruby] +#test01 +test03 diff --git a/roles/ruby_sites/defaults/main.yml b/roles/ruby_sites/defaults/main.yml index 5769f1d..7635fcc 100644 --- a/roles/ruby_sites/defaults/main.yml +++ b/roles/ruby_sites/defaults/main.yml @@ -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" \ No newline at end of file diff --git a/roles/ruby_sites/tasks/site.yml b/roles/ruby_sites/tasks/site.yml index 9ca7c73..88774c9 100644 --- a/roles/ruby_sites/tasks/site.yml +++ b/roles/ruby_sites/tasks/site.yml @@ -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}}" - \ No newline at end of file + +- 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}}" \ No newline at end of file diff --git a/ruby_site.yml b/ruby_site.yml index 4bb5693..89e7978 100644 --- a/ruby_site.yml +++ b/ruby_site.yml @@ -1,10 +1,9 @@ -- hosts: test_ruby +- hosts: ruby become: true roles: - testuser - common - rvm1-ansible - - ruby_sites - hosts: test_common sudo: True roles: diff --git a/site.yml b/site.yml index 9306c80..819a8aa 100644 --- a/site.yml +++ b/site.yml @@ -14,8 +14,13 @@ - backupclient - hosts: ruby - user: root - become: False + become: true + roles: + - common + - rvm1-ansible + +- hosts: test_common + sudo: True roles: - common