Skip to content

Commit

Permalink
Refactor site yml
Browse files Browse the repository at this point in the history
  • Loading branch information
storax committed Jul 31, 2015
1 parent ed7c43b commit 6e8365d
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 63 deletions.
12 changes: 12 additions & 0 deletions base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---

- name: Common base role
hosts: [masterservers, crafternodes]
sudo: yes
sudo_user: root
remote_user: vagrant
vars_files:
- env_vars/secret.yml
- env_vars/base.yml
roles:
- base
24 changes: 24 additions & 0 deletions crafternodes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---

# Add masterservers to hosts but disable all roles
# This is necessary for gathering facts
# So we can set the right hostname for rabbitmq and the db
- name: Create RayCrafter crafter node
hosts: [crafternodes, masterservers]
sudo: yes
sudo_user: root
remote_user: vagrant
vars_files:
- env_vars/secret.yml
- env_vars/base.yml
- env_vars/crafternode.yml
roles:
- {role: supervisor, when: "'crafternodes' in group_names"}
- {role: web, when: "'crafternodes' in group_names"}
- {role: celery, when: "'crafternodes' in group_names"}
- {role: graylog, when: "'crafternodes' in group_names"}
- {role: gridftp, when: "'crafternodes' in group_names"}
tasks:
- name: Copy private ssh key of masterserver
copy: src="{{playbook_dir}}/files/ssh/id_rsa" dest="~/.ssh/id_rsa"
owner={{ ansible_ssh_user }} mode=0700
9 changes: 9 additions & 0 deletions hlrs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

- name: Setup raycrafter at the HLRS
hosts: hlrs
sudo: no
vars_files:
- env_vars/hlrs.yml
roles:
- hlrsvenv
22 changes: 22 additions & 0 deletions masterserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

- name: Create RayCrafter master server
hosts: masterservers
sudo: yes
sudo_user: root
remote_user: vagrant
vars_files:
- env_vars/secret.yml
- env_vars/base.yml
- env_vars/masterserver.yml
roles:
- supervisor
- jdauphant.ssl-certs
- jdauphant.nginx
- f500.elasticsearch
- graylog2.graylog
- db
- rabbitmq
- gunicorn
- web
- graylog
67 changes: 4 additions & 63 deletions site.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,6 @@
---

- name: Common base role
hosts: all
sudo: yes
sudo_user: root
remote_user: vagrant
vars_files:
- env_vars/secret.yml
- env_vars/base.yml
roles:
- base

- name: Create RayCrafter master server
hosts: masterservers
sudo: yes
sudo_user: root
remote_user: vagrant
vars_files:
- env_vars/secret.yml
- env_vars/base.yml
- env_vars/masterserver.yml
roles:
- supervisor
- jdauphant.ssl-certs
- jdauphant.nginx
- f500.elasticsearch
- graylog2.graylog
- db
- rabbitmq
- gunicorn
- web
- graylog

# Add masterservers to hosts but disable all roles
# This is necessary for gathering facts
# So we can set the right hostname for rabbitmq and the db
- name: Create RayCrafter crafter node
hosts: [crafternodes, masterservers]
sudo: yes
sudo_user: root
remote_user: vagrant
vars_files:
- env_vars/secret.yml
- env_vars/base.yml
- env_vars/crafternode.yml
roles:
- {role: supervisor, when: "'crafternodes' in group_names"}
- {role: web, when: "'crafternodes' in group_names"}
- {role: celery, when: "'crafternodes' in group_names"}
- {role: graylog, when: "'crafternodes' in group_names"}
- {role: gridftp, when: "'crafternodes' in groubp_names"}
tasks:
- name: Copy private ssh key of masterserver
copy: src="{{playbook_dir}}/files/ssh/id_rsa" dest="~/.ssh/id_rsa"
owner={{ ansible_ssh_user }} mode=0700


- name: Setup raycrafter at the HLRS
hosts: hlrs
sudo: no
vars_files:
- env_vars/hlrs.yml
roles:
- hlrsvenv
- include: base.yml
- include: masterserver.yml
- include: crafternodes.yml
- include: hlrs.yml

0 comments on commit 6e8365d

Please sign in to comment.