Commit 13d50a60 by Bach Dániel

add centos support

parent 939f7679
...@@ -13,16 +13,31 @@ ...@@ -13,16 +13,31 @@
- user: root - user: root
- group: root - group: root
{% if grains['os_family'] == 'RedHat' %}
/etc/systemd/system/agentdriver.service:
file.managed:
- user: root
- group: root
- template: jinja
- source: file:///home/{{ pillar['user'] }}/agentdriver/miscellaneous/agentdriver.service
{% else %}
/etc/init/agentdriver.conf: /etc/init/agentdriver.conf:
file.managed: file.managed:
- user: root - user: root
- group: root - group: root
- template: jinja - template: jinja
- source: file:///home/{{ pillar['user'] }}/agentdriver/miscellaneous/agentdriver.conf - source: file:///home/{{ pillar['user'] }}/agentdriver/miscellaneous/agentdriver.conf
{% endif %}
{% if grains['os_family'] == 'RedHat' %}
incrond:
{% else %}
incron: incron:
{% endif %}
service: service:
- reload: true - reload: true
- running - running
- watch: - watch:
- file: /etc/incron.d/agentdriver - file: /etc/incron.d/agentdriver
\ No newline at end of file
...@@ -6,14 +6,21 @@ include: ...@@ -6,14 +6,21 @@ include:
agentdriver: agentdriver:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- virtualenvwrapper
- git - git
- python-pip - python-pip
- ntp - ntp
- incron - incron
{% if grains['os_family'] == 'RedHat' %}
- libmemcached-devel
- python-devel
- python-virtualenvwrapper
- zlib-devel
{% else %}
- libmemcached-dev - libmemcached-dev
- zlib1g-dev
- python-dev - python-dev
- virtualenvwrapper
- zlib1g-dev
{% endif %}
- require_in: - require_in:
- git: gitrepo_agentdriver - git: gitrepo_agentdriver
- virtualenv: virtualenv_agentdriver - virtualenv: virtualenv_agentdriver
...@@ -21,11 +28,19 @@ agentdriver: ...@@ -21,11 +28,19 @@ agentdriver:
- present - present
- name: {{ pillar['user'] }} - name: {{ pillar['user'] }}
- gid_from_name: True - gid_from_name: True
- shell: /bin/bash
- groups:
{% if grains['os_family'] == 'RedHat' %}
- wheel
{% else %}
- sudo
{% endif %}
- require_in: - require_in:
- git: gitrepo_agentdriver - git: gitrepo_agentdriver
- virtualenv: virtualenv_agentdriver - virtualenv: virtualenv_agentdriver
service: service:
- running - running
- enable: true
- watch: - watch:
- pkg: agentdriver - pkg: agentdriver
- sls: agentdriver.gitrepo - sls: agentdriver.gitrepo
......
...@@ -16,6 +16,24 @@ requirements: ...@@ -16,6 +16,24 @@ requirements:
- require: - require:
- user: {{ pillar['graphite']['user'] }} - user: {{ pillar['graphite']['user'] }}
{% if grains['os_family'] == 'RedHat' %}
/etc/systemd/system/graphite.service:
file.managed:
- user: root
- group: root
- template: jinja
- source: salt://graphite/files/graphite.service
/etc/systemd/system/graphite-carbon.service:
file.managed:
- user: root
- group: root
- template: jinja
- source: salt://graphite/files/graphite-carbon.service
{% else %}
/etc/init/graphite.conf: /etc/init/graphite.conf:
file.managed: file.managed:
- user: root - user: root
...@@ -29,6 +47,7 @@ requirements: ...@@ -29,6 +47,7 @@ requirements:
- group: root - group: root
- template: jinja - template: jinja
- source: salt://graphite/files/graphite-carbon.conf - source: salt://graphite/files/graphite-carbon.conf
{% endif %}
/opt/graphite: /opt/graphite:
file.directory: file.directory:
......
[Unit]
Description=Graphite Carbon
After=network.target
[Service]
User={{ pillar['graphite']['user'] }}
Group={{ pillar['graphite']['user'] }}
Environment=PYTHONPATH=/opt/graphite/lib GRAPHITE_ROOT=/opt/graphite
WorkingDirectory=/opt/graphite/bin/
ExecStart=/bin/bash -c "source /etc/profile; workon graphite; exec twistd --nodaemon --reactor=epoll --no_save carbon-cache"
Restart=always
[Install]
WantedBy=multi-user.target
diff --git a/render/evaluator.py b/render/evaluator.py
index 70490a2..ee7cfd1 100644
--- a/render/evaluator.py
+++ b/render/evaluator.py
@@ -37,7 +37,7 @@ def evaluateTokens(requestContext, tokens):
return float(tokens.number.scientific[0])
elif tokens.string:
- return str(tokens.string)[1:-1]
+ return unicode(tokens.string)[1:-1]
elif tokens.boolean:
return tokens.boolean[0] == 'true'
diff --git a/render/glyph.py b/render/glyph.py
index a2cc893..7daadce 100644
--- a/render/glyph.py
+++ b/render/glyph.py
@@ -181,7 +181,7 @@ class Graph:
self.drawRectangle( 0, 0, self.width, self.height )
if 'colorList' in params:
- colorList = unquote_plus( str(params['colorList']) ).split(',')
+ colorList = unquote_plus( unicode(params['colorList']) ).split(',')
else:
colorList = self.defaultColorList
self.colors = itertools.cycle( colorList )
@@ -572,7 +572,7 @@ class LineGraph(Graph):
if 'yUnitSystem' not in params:
params['yUnitSystem'] = 'si'
else:
- params['yUnitSystem'] = str(params['yUnitSystem']).lower()
+ params['yUnitSystem'] = unicode(params['yUnitSystem']).lower()
if params['yUnitSystem'] not in UnitSystems.keys():
params['yUnitSystem'] = 'si'
@@ -630,11 +630,11 @@ class LineGraph(Graph):
self.setColor( self.foregroundColor )
if params.get('title'):
- self.drawTitle( str(params['title']) )
+ self.drawTitle( unicode(params['title']) )
if params.get('vtitle'):
- self.drawVTitle( str(params['vtitle']) )
+ self.drawVTitle( unicode(params['vtitle']) )
if self.secondYAxis and params.get('vtitleRight'):
- self.drawVTitle( str(params['vtitleRight']), rightAlign=True )
+ self.drawVTitle( unicode(params['vtitleRight']), rightAlign=True )
self.setFont()
if not params.get('hideLegend', len(self.data) > settings.LEGEND_MAX_ITEMS):
@@ -1582,7 +1582,7 @@ class PieGraph(Graph):
if slice['value'] < 10 and slice['value'] != int(slice['value']):
label = "%.2f" % slice['value']
else:
- label = str(int(slice['value']))
+ label = unicode(int(slice['value']))
extents = self.getExtents(label)
theta = slice['midAngle']
x = self.x0 + (self.radius / 2.0 * math.cos(theta))
diff --git a/render/hashing.py b/render/hashing.py
index 6575650..45f1bfe 100644
--- a/render/hashing.py
+++ b/render/hashing.py
@@ -49,7 +49,7 @@ def stripControlChars(string):
def compactHash(string):
hash = md5()
- hash.update(string)
+ hash.update(string.encode('utf-8'))
return hash.hexdigest()
[Unit]
Description=Graphite
After=network.target
[Service]
User={{ pillar['graphite']['user'] }}
Group={{ pillar['graphite']['user'] }}
WorkingDirectory=/opt/graphite/webapp/graphite
ExecStart=/bin/bash -c "source /etc/profile; workon graphite; exec python manage.py runserver [::]:8081"
Restart=always
[Install]
WantedBy=multi-user.target
...@@ -6,11 +6,18 @@ include: ...@@ -6,11 +6,18 @@ include:
graphite: graphite:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- virtualenvwrapper
- git - git
- python-pip - python-pip
- ntp - ntp
{% if grains['os_family'] == 'RedHat' %}
- pycairo
- python-devel
- python-virtualenvwrapper
{% else %}
- python-cairo - python-cairo
- python-dev
- virtualenvwrapper
{% endif %}
- require: - require:
- user: {{ pillar['graphite']['user'] }} - user: {{ pillar['graphite']['user'] }}
- require_in: - require_in:
...@@ -24,7 +31,9 @@ graphite: ...@@ -24,7 +31,9 @@ graphite:
service: service:
- running - running
- enable: True
graphite-carbon: graphite-carbon:
service: service:
- running - running
- enable: True
...@@ -14,6 +14,25 @@ global-site-packages: ...@@ -14,6 +14,25 @@ global-site-packages:
- require: - require:
- virtualenv: virtualenv_graphite - virtualenv: virtualenv_graphite
unicode-fix-diff:
file.managed:
- name: /home/{{pillar['graphite']['user'] }}/graphite-unicode-fix.diff
- template: jinja
- source: salt://graphite/files/graphite-unicode-fix.diff
- user: {{ pillar['graphite']['user'] }}
- group: {{ pillar['graphite']['user'] }}
unicode-fix:
cmd.run:
- user: {{ pillar['graphite']['user'] }}
- cwd: /opt/graphite/webapp/graphite
- name: patch -N -p1 < /home/{{pillar['graphite']['user'] }}/graphite-unicode-fix.diff
- onlyif: patch -N --dry-run --silent -p1 < /home/{{pillar['graphite']['user'] }}/graphite-unicode-fix.diff
- require:
- virtualenv: virtualenv_graphite
- user: {{ pillar['graphite']['user'] }}
- file: unicode-fix-diff
salt://graphite/files/syncdb.sh: salt://graphite/files/syncdb.sh:
cmd.script: cmd.script:
- template: jinja - template: jinja
......
...@@ -8,27 +8,52 @@ manager_postactivate: ...@@ -8,27 +8,52 @@ manager_postactivate:
portal.conf: portal.conf:
file.managed: file.managed:
{% if pillar['deployment_type'] == 'production' %} {% if grains['os_family'] == 'RedHat' %}
- name: /etc/init/portal-uwsgi.conf - name: /etc/systemd/system/portal.service
{% else %}
- name: /etc/init/portal.conf
{% endif %}
- user: root - user: root
- group: root - group: root
- template: jinja - template: jinja
{% if grains['os_family'] == 'RedHat' %}
{% if pillar['deployment_type'] == 'production' %}
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal-uwsgi.service
{% else %}
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal.service
{% endif %}
{% else %}
{% if pillar['deployment_type'] == 'production' %}
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal-uwsgi.conf - source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal-uwsgi.conf
{% else %} {% else %}
- name: /etc/init/portal.conf - source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal.conf
{% endif %}
{% endif %}
{% if grains['os_family'] == 'RedHat' %}
/etc/systemd/system/manager.service:
file.managed:
- user: root - user: root
- group: root - group: root
- template: jinja - template: jinja
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal.conf - source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/manager.service
{% endif %}
/etc/systemd/system/managercelery@.service:
file.managed:
- user: root
- group: root
- template: jinja
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/managercelery@.service
{% else %}
/etc/init/manager.conf: /etc/init/manager.conf:
file.managed: file.managed:
- user: root - user: root
- group: root - group: root
- template: jinja - template: jinja
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/manager.conf - source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/manager.conf
/etc/init/mancelery.conf: /etc/init/mancelery.conf:
file.managed: file.managed:
- user: root - user: root
...@@ -49,6 +74,7 @@ portal.conf: ...@@ -49,6 +74,7 @@ portal.conf:
- group: root - group: root
- template: jinja - template: jinja
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/slowcelery.conf - source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/slowcelery.conf
{% endif %}
salt://manager/files/init.sh: salt://manager/files/init.sh:
cmd.script: cmd.script:
......
ignore_invalid_headers on;
server {
listen 443 ssl default;
ssl on;
ssl_certificate /etc/ssl/certs/circle.pem;
ssl_certificate_key /etc/ssl/certs/circle.pem;
{% if pillar['deployment_type'] == "production" %}
location /media {
alias /home/{{ pillar['user'] }}/circle/circle/media; # your Django project's media files
}
location /static {
alias /home/{{ pillar['user'] }}/circle/circle/static_collected; # your Django project's static files
}
{% endif %}
location /doc {
alias /home/cloud/circle-website/_build/html;
}
location / {
{% if pillar['deployment_type'] == "production" %}
uwsgi_pass unix:///tmp/uwsgi.sock;
include /etc/nginx/uwsgi_params; # or the uwsgi_params you installed manually
{% else %}
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_Host;
proxy_set_header X-Forwarded-Protocol https;
{% endif %}
}
location /vnc/ {
proxy_pass http://localhost:9999;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support (nginx 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
listen 80 default;
rewrite ^ https://$host/; # permanent;
}
ignore_invalid_headers on; # For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
server { # * Official Russian Documentation: http://nginx.org/ru/docs/
listen 443 ssl default;
ssl on; user nginx;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; worker_processes 1;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
error_log /var/log/nginx/error.log;
{% if pillar['deployment_type'] == "production" %} #error_log /var/log/nginx/error.log notice;
location /media { #error_log /var/log/nginx/error.log info;
alias /home/{{ pillar['user'] }}/circle/circle/media; # your Django project's media files
} pid /run/nginx.pid;
location /static {
alias /home/{{ pillar['user'] }}/circle/circle/static_collected; # your Django project's static files
}
{% endif %}
location /doc {
alias /home/cloud/circle-website/_build/html;
}
location / {
{% if pillar['deployment_type'] == "production" %}
uwsgi_pass unix:///tmp/uwsgi.sock;
include /etc/nginx/uwsgi_params; # or the uwsgi_params you installed manually
{% else %}
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_Host;
proxy_set_header X-Forwarded-Protocol https;
{% endif %}
}
location /vnc/ {
proxy_pass http://localhost:9999;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support (nginx 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server { events {
listen 80 default; worker_connections 1024;
rewrite ^ https://$host/; # permanent;
} }
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
index index.html index.htm;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
}
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
...@@ -3,6 +3,7 @@ export AMQP_URI='amqp://{{ pillar['amqp']['user'] }}:{{ pillar['amqp']['password ...@@ -3,6 +3,7 @@ export AMQP_URI='amqp://{{ pillar['amqp']['user'] }}:{{ pillar['amqp']['password
export CACHE_URI='{{ pillar['cache'] }}' export CACHE_URI='{{ pillar['cache'] }}'
export DJANGO_SETTINGS_MODULE='circle.settings.{{ pillar['deployment_type'] }}' export DJANGO_SETTINGS_MODULE='circle.settings.{{ pillar['deployment_type'] }}'
export DJANGO_TIME_ZONE=UTC
export DJANGO_DB_HOST='localhost' export DJANGO_DB_HOST='localhost'
export DJANGO_DB_PASSWORD='{{ pillar['database']['password'] }}' export DJANGO_DB_PASSWORD='{{ pillar['database']['password'] }}'
export DJANGO_FIREWALL_SETTINGS='{"dns_ip": "8.8.8.8", "dns_hostname": export DJANGO_FIREWALL_SETTINGS='{"dns_ip": "8.8.8.8", "dns_hostname":
......
#!/bin/bash #!/bin/bash
sudo stop manager >/dev/null 2>&1
sudo stop portal >/dev/null 2>&1
source /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/activate >/dev/null 2>&1 source /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/activate >/dev/null 2>&1
source /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/postactivate >/dev/null 2>&1 source /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/postactivate >/dev/null 2>&1
MANAGE="python /home/{{ pillar['user'] }}/circle/circle/manage.py" MANAGE="python /home/{{ pillar['user'] }}/circle/circle/manage.py"
OUT=$( ($MANAGE syncdb --noinput && OUT=$( $MANAGE migrate 2>&1)
$MANAGE migrate acl &&
$MANAGE migrate firewall &&
$MANAGE migrate storage &&
$MANAGE syncdb --migrate --noinput &&
$MANAGE migrate vm --merge) 2>&1)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
/usr/bin/python -c "import sys; import json; sys.stdout.write(json.dumps({'changed': False, 'comment': sys.stdin.read()}) + '\n')" <<< "$OUT" /usr/bin/python -c "import sys; import json; sys.stdout.write(json.dumps({'changed': False, 'comment': sys.stdin.read()}) + '\n')" <<< "$OUT"
exit 1 exit 1
fi fi
COUNT=$(/bin/egrep "Migrating forwards to" -c <<< "$OUT") COUNT=$(/bin/egrep " *Applying " -c <<< "$OUT")
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
CHANGED=yes CHANGED=yes
else else
......
...@@ -11,39 +11,74 @@ include: ...@@ -11,39 +11,74 @@ include:
manager: manager:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- virtualenvwrapper
- postgresql - postgresql
- git - git
- python-pip - python-pip
- python-dev
- libpq-dev
- ntp - ntp
- rabbitmq-server - rabbitmq-server
- memcached - memcached
- gettext - gettext
- wget - wget
- swig
{% if grains['os_family'] == 'RedHat' %}
- libmemcached-devel
- postgresql-devel
- postgresql-libs
- postgresql-server
- libxml2-devel
- libxslt-devel
- python-devel
- python-virtualenvwrapper
{% else %}
- libmemcached-dev
- libpq-dev
- libxml2-dev - libxml2-dev
- libxslt1-dev - libxslt1-dev
- libmemcached-dev - python-dev
- swig - virtualenvwrapper
{% endif %}
- require_in: - require_in:
- service: postgres_service - service: postgres_service
user: user:
- present - present
- name: {{ pillar['user'] }} - name: {{ pillar['user'] }}
- gid_from_name: True - gid_from_name: True
- shell: /bin/bash
- groups:
{% if grains['os_family'] == 'RedHat' %}
- wheel
{% else %}
- sudo
{% endif %}
service: service:
- running - running
- enable: True
- watch: - watch:
- file: manager_postactivate - file: manager_postactivate
{% if grains['os_family'] == 'RedHat' %}
- file: /etc/systemd/system/manager.service
- file: /etc/systemd/system/managercelery@.service
{% else %}
- file: /etc/init/manager.conf - file: /etc/init/manager.conf
- file: /etc/init/mancelery.conf - file: /etc/init/mancelery.conf
- file: /etc/init/moncelery.conf - file: /etc/init/moncelery.conf
- file: /etc/init/slowcelery.conf - file: /etc/init/slowcelery.conf
{% endif %}
- sls: manager.gitrepo - sls: manager.gitrepo
portal: portal:
service: service:
- running - running
- enable: True
- watch:
- file: manager_postactivate
- file: portal.conf
memcached:
service:
- running
- enable: True
- require:
- pkg: manager
nginx: nginx:
service.running:
- enable: True
- require:
- pkg: nginx
- cmd: circlecert
- file: nginxdefault
{% if grains['os_family'] == 'RedHat' %}
- file: nginxconf
{% endif %}
pkg: pkg:
- installed - installed
pkgrepo.managed: circlecert:
- ppa: nginx/stable cmd.run:
- require_in: - name: ./make-dummy-cert circle.pem
- pkg: nginx - cwd: /etc/ssl/certs/
- creates: /etc/ssl/certs/circle.pem
nginxdefault:
file.managed: file.managed:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/nginx/conf.d/default.conf - name: /etc/nginx/conf.d/default.conf
{% else %}
- name: /etc/nginx/sites-enabled/default
{% endif %}
- template: jinja
- source: salt://manager/files/nginx-default-site.conf
- user: root
- group: root
- require:
- pkg: nginx
{% if grains['os_family'] == 'RedHat' %}
nginxconf:
file.managed:
- name: /etc/nginx/nginx.conf
- template: jinja - template: jinja
- source: salt://manager/files/nginx.conf - source: salt://manager/files/nginx.conf
- user: root - user: root
- group: root - group: root
- require: - require:
- pkg: nginx - pkg: nginx
{% endif %}
{% if grains['os'] == 'Ubuntu' %}
nodejs-legacy: nodejs-legacy:
pkg.installed pkg.installed
{% endif %}
npm: npm:
{% if grains['os'] == 'Ubuntu' %}
pkg.installed: pkg.installed:
- require: - require:
- pkg: nodejs-legacy - pkg: nodejs-legacy
{% else %}
pkg.installed
{% endif %}
bower: bower:
npm.installed: npm.installed:
......
{% if grains['os_family'] == 'RedHat' %}
postgresql_initdb:
cmd.run:
- cwd: /
- user: root
- name: service postgresql initdb
- unless: test -f /var/lib/pgsql/data/postgresql.conf
- env:
LC_ALL: C.UTF-8
file.managed:
- name: /var/lib/pgsql/data/pg_hba.conf
- template: jinja
- source: salt://manager/files/pg_hba.conf
- user: postgres
- group: postgres
- mode: 600
- require:
- cmd: postgresql_initdb
{% endif %}
postgres_service: postgres_service:
service.running: service.running:
- name: postgresql - name: postgresql
- enable: True
{% if grains['os_family'] == 'RedHat' %}
- require:
- file: postgresql_initdb
{% endif %}
dbuser: dbuser:
postgres_user.present: postgres_user.present:
......
...@@ -2,6 +2,7 @@ rabbitmq-server: ...@@ -2,6 +2,7 @@ rabbitmq-server:
pkg.installed: pkg.installed:
- name: rabbitmq-server - name: rabbitmq-server
service.running: service.running:
- enable: True
- require: - require:
- pkg: rabbitmq-server - pkg: rabbitmq-server
......
include: include:
- common - common
# m2crypto workaround
# /usr/include/openssl/opensslconf.h:31: Error: CPP #error
# ""This openssl-devel package does not work your architecture?"".
# Use the -cpperraswarn option to continue swig processing.
{% if grains['os_family'] == 'RedHat' %}
m2crypto_swig_env:
environ.setenv:
- name: SWIG_FEATURES
- value: -D__x86_64__
{% endif %}
virtualenv_manager: virtualenv_manager:
virtualenv.managed: virtualenv.managed:
- name: /home/{{ pillar['user'] }}/.virtualenvs/circle - name: /home/{{ pillar['user'] }}/.virtualenvs/circle
...@@ -10,6 +22,9 @@ virtualenv_manager: ...@@ -10,6 +22,9 @@ virtualenv_manager:
- no_chown: true - no_chown: true
- require: - require:
- git: gitrepo - git: gitrepo
{% if grains['os_family'] == 'RedHat' %}
- environ: m2crypto_swig_env
{% endif %}
salt://manager/files/syncdb.sh: salt://manager/files/syncdb.sh:
cmd.script: cmd.script:
......
...@@ -6,9 +6,20 @@ ...@@ -6,9 +6,20 @@
- group: {{ pillar['user'] }} - group: {{ pillar['user'] }}
- mode: 700 - mode: 700
{% if grains['os_family'] == 'RedHat' %}
/etc/systemd/system/monitor-client.service:
file.managed:
- user: root
- group: root
- template: jinja
- source: file:///home/{{ pillar['user'] }}/monitor-client/miscellaneous/monitor-client.service
{% else %}
/etc/init/monitor-client.conf: /etc/init/monitor-client.conf:
file.managed: file.managed:
- user: root - user: root
- group: root - group: root
- template: jinja - template: jinja
- source: file:///home/{{ pillar['user'] }}/monitor-client/miscellaneous/monitor-client.conf - source: file:///home/{{ pillar['user'] }}/monitor-client/miscellaneous/monitor-client.conf
{% endif %}
...@@ -6,17 +6,23 @@ include: ...@@ -6,17 +6,23 @@ include:
monitor-client: monitor-client:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- virtualenvwrapper
- git - git
- python-pip - python-pip
- ntp - ntp
- wget - wget
{% if grains['os_family'] == 'RedHat' %}
- python-devel
- python-virtualenvwrapper
{% else %}
- python-dev - python-dev
- virtualenvwrapper
{% endif %}
- require_in: - require_in:
- git: gitrepo_monitor-client - git: gitrepo_monitor-client
- virtualenv: virtualenv_monitor-client - virtualenv: virtualenv_monitor-client
service: service:
- running - running
- enable: True
- watch: - watch:
- pkg: monitor-client - pkg: monitor-client
- sls: monitor-client.gitrepo - sls: monitor-client.gitrepo
......
...@@ -6,6 +6,23 @@ ...@@ -6,6 +6,23 @@
- group: {{ pillar['user'] }} - group: {{ pillar['user'] }}
- mode: 700 - mode: 700
{% if grains['os_family'] == 'RedHat' %}
/etc/systemd/system/storagecelery@.service:
file.managed:
- user: root
- group: root
- template: jinja
- source: file:///home/{{ pillar['user'] }}/storagedriver/miscellaneous/storagecelery@.service
/etc/systemd/system/storage.service:
file.managed:
- user: root
- group: root
- template: jinja
- source: file:///home/{{ pillar['user'] }}/storagedriver/miscellaneous/storage.service
{% else %}
/etc/init/storagecelery.conf: /etc/init/storagecelery.conf:
file.managed: file.managed:
- user: root - user: root
...@@ -19,6 +36,7 @@ ...@@ -19,6 +36,7 @@
- group: root - group: root
- template: jinja - template: jinja
- source: file:///home/{{ pillar['user'] }}/storagedriver/miscellaneous/storage.conf - source: file:///home/{{ pillar['user'] }}/storagedriver/miscellaneous/storage.conf
{% endif %}
/datastore: /datastore:
file.directory: file.directory:
......
...@@ -7,14 +7,22 @@ include: ...@@ -7,14 +7,22 @@ include:
storagedriver: storagedriver:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- virtualenvwrapper
- git - git
- python-pip - python-pip
- python-dev
- libmemcached-dev
- ntp - ntp
- zlib1g-dev {% if grains['os_family'] == 'RedHat' %}
- libmemcached-devel
- python-devel
- python-virtualenvwrapper
- qemu-img
- zlib-devel
{% else %}
- libmemcached-dev
- python-dev
- qemu-utils - qemu-utils
- virtualenvwrapper
- zlib1g-dev
{% endif %}
- require_in: - require_in:
- git: gitrepo_storagedriver - git: gitrepo_storagedriver
- virtualenv: virtualenv_storagedriver - virtualenv: virtualenv_storagedriver
...@@ -22,6 +30,7 @@ storagedriver: ...@@ -22,6 +30,7 @@ storagedriver:
storage: storage:
service: service:
- running - running
- enable: True
- watch: - watch:
- pkg: storagedriver - pkg: storagedriver
- sls: storagedriver.gitrepo - sls: storagedriver.gitrepo
......
...@@ -6,26 +6,19 @@ ...@@ -6,26 +6,19 @@
- group: {{ pillar['user'] }} - group: {{ pillar['user'] }}
- mode: 700 - mode: 700
/etc/init/vmcelery.conf: {% set service_dir = "/etc/systemd/system/" if grains['os_family'] == 'RedHat' else "/etc/init/" %}
file.managed: {% set service_files = (("vmcelery@.service", "netcelery@.service", "node.service")
- user: root if grains['os_family'] == 'RedHat' else
- group: root ("vmcelery.service", "netcelery.service", "node.service")) %}
- template: jinja
- source: file:///home/{{ pillar['user'] }}/vmdriver/miscellaneous/vmcelery.conf
/etc/init/netcelery.conf:
file.managed:
- user: root
- group: root
- template: jinja
- source: file:///home/{{ pillar['user'] }}/vmdriver/miscellaneous/netcelery.conf
/etc/init/node.conf: {% for file in service_files %}
{{ service_dir ~ file }}:
file.managed: file.managed:
- user: root - user: root
- group: root - group: root
- template: jinja - template: jinja
- source: file:///home/{{ pillar['user'] }}/vmdriver/miscellaneous/node.conf - source: file:///home/{{ pillar['user'] }}/vmdriver/miscellaneous/{{ file }}
{% endfor %}
ovs-bridge: ovs-bridge:
cmd.run: cmd.run:
......
...@@ -7,36 +7,55 @@ include: ...@@ -7,36 +7,55 @@ include:
vmdriver: vmdriver:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- virtualenvwrapper
- git - git
- python-pip - python-pip
- python-dev
- python-augeas - python-augeas
- ntp - ntp
- wget - wget
- qemu-kvm
{% if grains['os_family'] == 'RedHat' %}
- libmemcached-devel
- libvirt
- libvirt-daemon
- libvirt-daemon-kvm
- libvirt-python
- libxml2-devel
- libxslt-devel
- python-devel
- python-virtualenvwrapper
- qemu-img
- zlib-devel
{% else %}
- libmemcached-dev
- libvirt-bin
- libxml2-dev
- libxslt1-dev
- openvswitch-common - openvswitch-common
- openvswitch-switch - openvswitch-switch
- openvswitch-controller - openvswitch-controller
- libvirt-bin - python-dev
- python-libvirt - python-libvirt
- libxml2-dev - virtualenvwrapper
- libmemcached-dev
- libxslt1-dev
- zlib1g-dev
- qemu-kvm
- qemu-utils - qemu-utils
- zlib1g-dev
{% endif %}
- require_in: - require_in:
- file: /etc/default/libvirt-bin - file: /etc/default/libvirt-bin
{% if grains['os_family'] == 'RedHat' %}
- service: libvirtd
{% else %}
- file: /etc/apparmor.d/libvirt/TEMPLATE - file: /etc/apparmor.d/libvirt/TEMPLATE
- file: /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper - file: /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper
- file: /var/lib/libvirt/serial - file: /var/lib/libvirt/serial
- augeas: libvirtconf
- service: libvirt-bin - service: libvirt-bin
{% endif %}
- augeas: libvirtconf
- git: gitrepo_vmdriver - git: gitrepo_vmdriver
- virtualenv: virtualenv_vmdriver - virtualenv: virtualenv_vmdriver
node: node:
service: service:
- running - running
- enable: True
- watch: - watch:
- pkg: vmdriver - pkg: vmdriver
- sls: vmdriver.gitrepo - sls: vmdriver.gitrepo
......
...@@ -10,13 +10,24 @@ libvirtconf: ...@@ -10,13 +10,24 @@ libvirtconf:
file.append: file.append:
- text: libvirtd_opts="-d -l" - text: libvirtd_opts="-d -l"
{% if grains['os_family'] == 'RedHat' %}
libvirtd:
{% else %}
libvirt-bin: libvirt-bin:
{% endif %}
service: service:
- running - running
- watch: - watch:
- file: /etc/default/libvirt-bin - file: /etc/default/libvirt-bin
- augeas: libvirtconf - augeas: libvirtconf
{% if grains['os_family'] == 'RedHat' %}
/usr/bin/kvm:
file.symlink:
- target: /usr/libexec/qemu-kvm
{% else %}
/etc/apparmor.d/libvirt/TEMPLATE: /etc/apparmor.d/libvirt/TEMPLATE:
file.managed: file.managed:
- source: salt://vmdriver/files/apparmor-libvirt - source: salt://vmdriver/files/apparmor-libvirt
...@@ -36,10 +47,15 @@ apparmor: ...@@ -36,10 +47,15 @@ apparmor:
- watch: - watch:
- file: /etc/apparmor.d/libvirt/TEMPLATE - file: /etc/apparmor.d/libvirt/TEMPLATE
- file: /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper - file: /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper
{% endif %}
/var/lib/libvirt/serial: /var/lib/libvirt/serial:
file.directory: file.directory:
- makedirs: True - makedirs: True
{% if grains['os_family'] == 'RedHat' %}
- user: qemu
{% else %}
- user: libvirt-qemu - user: libvirt-qemu
{% endif %}
- group: kvm - group: kvm
- mode: 755 - mode: 755
...@@ -5,38 +5,12 @@ virtualenv_vmdriver: ...@@ -5,38 +5,12 @@ virtualenv_vmdriver:
- runas: {{ pillar['user'] }} - runas: {{ pillar['user'] }}
- no_chown: true - no_chown: true
/home/{{ pillar['user'] }}/.virtualenvs/vmdriver/lib/python2.7/site-packages/libvirtmod_qemu.so: {% set libvirt_dir = "/usr/lib64/python2.7/site-packages/" if grains['os_family'] == 'RedHat' else "/usr/lib/python2.7/dist-packages/" %}
file.symlink:
- target: /usr/lib/python2.7/dist-packages/libvirtmod_qemu.so
- require:
- virtualenv: virtualenv_vmdriver
/home/{{ pillar['user'] }}/.virtualenvs/vmdriver/lib/python2.7/site-packages/libvirtmod.so:
file.symlink:
- target: /usr/lib/python2.7/dist-packages/libvirtmod.so
- require:
- virtualenv: virtualenv_vmdriver
/home/{{ pillar['user'] }}/.virtualenvs/vmdriver/lib/python2.7/site-packages/libvirt_qemu.py:
file.symlink:
- target: /usr/lib/python2.7/dist-packages/libvirt_qemu.py
- require:
- virtualenv: virtualenv_vmdriver
/home/{{ pillar['user'] }}/.virtualenvs/vmdriver/lib/python2.7/site-packages/libvirt.py:
file.symlink:
- target: /usr/lib/python2.7/dist-packages/libvirt.py
- require:
- virtualenv: virtualenv_vmdriver
/home/{{ pillar['user'] }}/.virtualenvs/vmdriver/lib/python2.7/site-packages/libvirt_qemu.pyc:
file.symlink:
- target: /usr/lib/python2.7/dist-packages/libvirt_qemu.pyc
- require:
- virtualenv: virtualenv_vmdriver
/home/{{ pillar['user'] }}/.virtualenvs/vmdriver/lib/python2.7/site-packages/libvirt.pyc: {% for file in ("libvirtmod_qemu.so", "libvirtmod.so", "libvirt_qemu.py", "libvirt.py", "libvirt_qemu.pyc", "libvirt.pyc") %}
/home/{{ pillar['user'] }}/.virtualenvs/vmdriver/lib/python2.7/site-packages/{{ file }}:
file.symlink: file.symlink:
- target: /usr/lib/python2.7/dist-packages/libvirt.pyc - target: {{ libvirt_dir + file }}
- require: - require:
- virtualenv: virtualenv_vmdriver - virtualenv: virtualenv_vmdriver
{% endfor %}
...@@ -6,9 +6,20 @@ ...@@ -6,9 +6,20 @@
- group: {{ pillar['user'] }} - group: {{ pillar['user'] }}
- mode: 700 - mode: 700
{% if grains['os_family'] == 'RedHat' %}
/etc/systemd/system/vncproxy.service:
file.managed:
- user: root
- group: root
- template: jinja
- source: file:///home/{{ pillar['user'] }}/vncproxy/miscellaneous/vncproxy.service
{% else %}
/etc/init/vncproxy.conf: /etc/init/vncproxy.conf:
file.managed: file.managed:
- user: root - user: root
- group: root - group: root
- template: jinja - template: jinja
- source: file:///home/{{ pillar['user'] }}/vncproxy/miscellaneous/vncproxy.conf - source: file:///home/{{ pillar['user'] }}/vncproxy/miscellaneous/vncproxy.conf
{% endif %}
...@@ -6,18 +6,27 @@ include: ...@@ -6,18 +6,27 @@ include:
vncproxy: vncproxy:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- virtualenvwrapper
- git - git
- python-pip - python-pip
- ntp - ntp
- wget - wget
{% if grains['os_family'] == 'RedHat' %}
- libffi-devel
- openssl-devel
- python-devel
- python-virtualenvwrapper
{% else %}
- libffi-dev - libffi-dev
- libssl-dev - libssl-dev
- python-dev
- virtualenvwrapper
{% endif %}
- require_in: - require_in:
- git: gitrepo_vncproxy - git: gitrepo_vncproxy
- virtualenv: virtualenv_vncproxy - virtualenv: virtualenv_vncproxy
service: service:
- running - running
- enable: True
- watch: - watch:
- pkg: vncproxy - pkg: vncproxy
- sls: vncproxy.gitrepo - sls: vncproxy.gitrepo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment