Commit 6f9c3e6a by Czémán Arnold

Add openvswitch standalone module; prettify some sls files

parent 8b56dbe7
include:
- openvswitch
/home/{{ pillar['fwdriver']['user'] }}/.virtualenvs/fw/bin/postactivate: /home/{{ pillar['fwdriver']['user'] }}/.virtualenvs/fw/bin/postactivate:
file.managed: file.managed:
- source: salt://fwdriver/files/postactivate - source: salt://fwdriver/files/postactivate
...@@ -80,25 +83,6 @@ systemd-sysctl: ...@@ -80,25 +83,6 @@ systemd-sysctl:
service.running: service.running:
- reload: True - reload: True
{# TODO: standalone module for openvswitch #}
openvswitch2:
pkg.installed:
- sources:
- openvswitch: salt://vmdriver/files/openvswitch-2.3.1-1.x86_64.rpm
cmd.run:
- name: mkdir /etc/openvswitch; restorecon -R /etc/openvswitch/
- creates: /etc/openvswitch
- require:
- pkg: openvswitch
service:
- name: openvswitch
- running
- enable: True
- require:
- cmd: openvswitch
- required_in:
- cmd: ovs-bridge
/root/firewall-init.te: /root/firewall-init.te:
file.managed: file.managed:
- source: salt://fwdriver/files/firewall-init.te - source: salt://fwdriver/files/firewall-init.te
......
...@@ -6,13 +6,13 @@ include: ...@@ -6,13 +6,13 @@ include:
firewall: firewall:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
- zlib-devel - zlib-devel
- python-virtualenvwrapper - python-virtualenvwrapper
- python-devel - python-devel
- libmemcached-devel - libmemcached-devel
- dhcp - dhcp
{% else %} {% else %}
- zlib1g-dev - zlib1g-dev
- virtualenvwrapper - virtualenvwrapper
- python-dev - python-dev
...@@ -20,7 +20,7 @@ firewall: ...@@ -20,7 +20,7 @@ firewall:
- openvswitch-switch - openvswitch-switch
- openvswitch-controller - openvswitch-controller
- isc-dhcp-server - isc-dhcp-server
{% endif %} {% endif %}
- git - git
- python-pip - python-pip
- ntp - ntp
......
...@@ -16,19 +16,23 @@ portal.conf: ...@@ -16,19 +16,23 @@ portal.conf:
- user: root - user: root
- group: root - group: root
- template: jinja - template: jinja
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
{% if pillar['deployment_type'] == 'production' %} {% if pillar['deployment_type'] == 'production' %}
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal-uwsgi.service - source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal-uwsgi.service
{% else %} {% else %}
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal.service - source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal.service
{% endif %} {% endif %}
{% else %}
{% else %}
{% if pillar['deployment_type'] == 'production' %} {% 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 %}
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal.conf - source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/portal.conf
{% endif %} {% endif %}
{% endif %}
{% endif %}
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
/etc/systemd/system/manager.service: /etc/systemd/system/manager.service:
......
...@@ -13,11 +13,11 @@ nginx: ...@@ -13,11 +13,11 @@ nginx:
circlecert: circlecert:
cmd.run: cmd.run:
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
- name: ./make-dummy-cert circle.pem - name: ./make-dummy-cert circle.pem
{% else %} {% else %}
- name: openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout circle.key -out circle.crt -subj '/CN=localhost/O=My Company Name LTD./C=US' && cat circle.key circle.crt > circle.pem && rm circle.key circle.crt; chmod 600 circle.pem - name: openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout circle.key -out circle.crt -subj '/CN=localhost/O=My Company Name LTD./C=US' && cat circle.key circle.crt > circle.pem && rm circle.key circle.crt; chmod 600 circle.pem
{% endif %} {% endif %}
- cwd: /etc/ssl/certs/ - cwd: /etc/ssl/certs/
- creates: /etc/ssl/certs/circle.pem - creates: /etc/ssl/certs/circle.pem
...@@ -37,11 +37,11 @@ nginx_selinux: ...@@ -37,11 +37,11 @@ nginx_selinux:
nginxdefault: nginxdefault:
file.managed: file.managed:
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
- name: /etc/nginx/conf.d/default.conf - name: /etc/nginx/conf.d/default.conf
{% else %} {% else %}
- name: /etc/nginx/sites-enabled/default - name: /etc/nginx/sites-enabled/default
{% endif %} {% endif %}
- template: jinja - template: jinja
- source: salt://manager/files/nginx-default-site.conf - source: salt://manager/files/nginx-default-site.conf
- user: root - user: root
......
...@@ -4,13 +4,13 @@ nodejs-legacy: ...@@ -4,13 +4,13 @@ nodejs-legacy:
{% endif %} {% endif %}
npm: npm:
{% if grains['os'] == 'Ubuntu' %} {% if grains['os'] == 'Ubuntu' %}
pkg.installed: pkg.installed:
- require: - require:
- pkg: nodejs-legacy - pkg: nodejs-legacy
{% else %} {% else %}
pkg.installed pkg.installed
{% endif %} {% endif %}
bower: bower:
npm.installed: npm.installed:
......
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
postgresql-server: postgresql-server:
pkg.installed pkg.installed
......
...@@ -11,11 +11,11 @@ vm: ...@@ -11,11 +11,11 @@ vm:
- ipaddr: {{ pillar['fwdriver']['vm_net_ip'] }} - ipaddr: {{ pillar['fwdriver']['vm_net_ip'] }}
- netmask: {{ pillar['fwdriver']['vm_net_mask'] }} - netmask: {{ pillar['fwdriver']['vm_net_mask'] }}
- pre_up_cmds: - pre_up_cmds:
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
- /bin/systemctl restart openvswitch - /bin/systemctl restart openvswitch
{% else %} {% else %}
- /etc/init.d/openvswitch-switch restart - /etc/init.d/openvswitch-switch restart
{% endif %} {% endif %}
- require: - require:
- cmd: ovs-if - cmd: ovs-if
...@@ -41,9 +41,9 @@ salt://network/files/fix_dhcp.sh: ...@@ -41,9 +41,9 @@ salt://network/files/fix_dhcp.sh:
isc-dhcp-server: isc-dhcp-server:
service: service:
- running - running
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
- name: dhcpd - name: dhcpd
{% endif %} {% endif %}
- enable: True - enable: True
- reload: True - reload: True
nfs-client: nfs-client:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
- nfs-utils - nfs-utils
{% else %} {% else %}
- nfs-common - nfs-common
{% endif %} {% endif %}
- require_in: - require_in:
- mount: /datastore - mount: /datastore
......
{% if grains['os_family'] == "RedHat" %}
openvswitch:
pkg.installed:
- sources:
- openvswitch: salt://openvswitch/files/openvswitch-2.3.1-1.x86_64.rpm
cmd.run:
- name: mkdir /etc/openvswitch; restorecon -R /etc/openvswitch/
- creates: /etc/openvswitch
- require:
- pkg: openvswitch
service:
- name: openvswitch
- running
- enable: True
- require:
- cmd: openvswitch
- required_in:
- cmd: ovs-bridge
{% endif %}
...@@ -10,20 +10,20 @@ rpcbind: ...@@ -10,20 +10,20 @@ rpcbind:
nfs-server: nfs-server:
service: service:
{% if grains['os_family'] != 'RedHat' %} {% if grains['os_family'] != 'RedHat' %}
- name: nfs-kernel-server - name: nfs-kernel-server
{% endif %} {% endif %}
- running - running
- watch: - watch:
- file: /etc/exports - file: /etc/exports
- require: - require:
- service: rpcbind - service: rpcbind
pkg.installed: pkg.installed:
{% if grains['os_family'] == 'RedHat' %} {% if grains['os_family'] == 'RedHat' %}
- name: nfs-utils - name: nfs-utils
{% else %} {% else %}
- name: nfs-kernel-server - name: nfs-kernel-server
{% endif %} {% endif %}
/etc/exports: /etc/exports:
file.managed: file.managed:
......
include:
- openvswitch
/home/{{ pillar['user'] }}/.virtualenvs/vmdriver/bin/postactivate: /home/{{ pillar['user'] }}/.virtualenvs/vmdriver/bin/postactivate:
file.managed: file.managed:
- source: salt://vmdriver/files/postactivate - source: salt://vmdriver/files/postactivate
...@@ -20,26 +23,6 @@ ...@@ -20,26 +23,6 @@
- source: file:///home/{{ pillar['user'] }}/vmdriver/miscellaneous/{{ file }} - source: file:///home/{{ pillar['user'] }}/vmdriver/miscellaneous/{{ file }}
{% endfor %} {% endfor %}
{# TODO: standalone module for openvswitch #}
{% if grains['os_family'] == 'RedHat' %}
openvswitch:
pkg.installed:
- sources:
- openvswitch: salt://vmdriver/files/openvswitch-2.3.1-1.x86_64.rpm
cmd.run:
- name: mkdir /etc/openvswitch; restorecon -R /etc/openvswitch/
- creates: /etc/openvswitch
- require:
- pkg: openvswitch
service:
- running
- enable: True
- require:
- cmd: openvswitch
- required_in:
- cmd: ovs-bridge
{% endif %}
ovs-bridge: ovs-bridge:
cmd.run: cmd.run:
- name: ovs-vsctl add-br cloud - name: ovs-vsctl add-br cloud
......
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