From 5bb3a44c71c72ae3da649e1b855dbfc00a9e95f7 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Sat, 18 Jun 2016 13:23:12 +0200 Subject: [PATCH] Add racktables role (unfinished) and apply it. --- group_vars/all | 5 +++++ roles/racktables/handlers/main.yml | 4 ++++ roles/racktables/meta/main.yml | 4 ++++ roles/racktables/tasks/main.yml | 30 +++++++++++++++++++++++++++++ roles/racktables/templates/vhost.j2 | 19 ++++++++++++++++++ site.yml | 5 +++++ 6 files changed, 67 insertions(+) create mode 100644 roles/racktables/handlers/main.yml create mode 100644 roles/racktables/meta/main.yml create mode 100644 roles/racktables/tasks/main.yml create mode 100644 roles/racktables/templates/vhost.j2 diff --git a/group_vars/all b/group_vars/all index 16a8384..02b2307 100644 --- a/group_vars/all +++ b/group_vars/all @@ -46,6 +46,11 @@ owncloud_dbpass: tnEykTqtsC9pECz7wAUJ prosody_admin: moepman@jabber.binary-kitchen.de prosody_domain: jabber.binary-kitchen.de +racktables_domain: racktables.binary.kitchen +racktables_dbname: racktables +racktables_dbuser: racktables +racktables_dbpass: chee6iechuz1EghuheiD + snmp_allowed: - 172.23.2.5 - 172.23.2.6 diff --git a/roles/racktables/handlers/main.yml b/roles/racktables/handlers/main.yml new file mode 100644 index 0000000..44975c4 --- /dev/null +++ b/roles/racktables/handlers/main.yml @@ -0,0 +1,4 @@ +--- + +- name: Restart nginx + service: name=nginx state=restarted diff --git a/roles/racktables/meta/main.yml b/roles/racktables/meta/main.yml new file mode 100644 index 0000000..34de459 --- /dev/null +++ b/roles/racktables/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: +- { role: nginx, nginx_ssl: False } diff --git a/roles/racktables/tasks/main.yml b/roles/racktables/tasks/main.yml new file mode 100644 index 0000000..7dab177 --- /dev/null +++ b/roles/racktables/tasks/main.yml @@ -0,0 +1,30 @@ +--- + +- name: Install dependencies + apt: name={{ item }} state=present + with_items: + - mysql-server + - php5-fpm + - php5-gd + - php5-mysql + - python-mysqldb + +- name: Configure MySQL database + mysql_db: name={{ racktables_dbname }} + +- name: Configure MySQL user + mysql_user: name={{ racktables_dbuser }} password={{ racktables_dbpass }} priv={{ racktables_dbname }}.*:ALL state=present + +- name: Create vhost directory + file: path=/var/www/racktables state=directory owner=www-data group=www-data + +- name: Configure vhost + template: src=vhost.j2 dest=/etc/nginx/sites-available/racktables + notify: Restart nginx + +- name: Enable vhost + file: src=/etc/nginx/sites-available/racktables dest=/etc/nginx/sites-enabled/racktables state=link + notify: Restart nginx + +- name: Start php5-fpm + service: name=php5-fpm state=started enabled=yes diff --git a/roles/racktables/templates/vhost.j2 b/roles/racktables/templates/vhost.j2 new file mode 100644 index 0000000..793cc43 --- /dev/null +++ b/roles/racktables/templates/vhost.j2 @@ -0,0 +1,19 @@ +server { + listen 80; + listen [::]:80; + + server_name {{ racktables_domain }}; + + root /var/www/racktables; + + index index.php; + + location ~ \.php(?:$|/) { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_intercept_errors on; + } +} diff --git a/site.yml b/site.yml index 73884ef..54638f4 100644 --- a/site.yml +++ b/site.yml @@ -6,6 +6,11 @@ - common - ntp +- name: Setup monitoring server + hosts: nabia.binary.kitchen + roles: + - racktables + - name: Setup ldap server hosts: helium.binary-kitchen.net roles: