diff --git a/common/files/vimrc.jinja b/common/files/vimrc.jinja index 01e27d9..cd9ba8b 100644 --- a/common/files/vimrc.jinja +++ b/common/files/vimrc.jinja @@ -68,3 +68,4 @@ set smarttab " always uses spaces instead of tab characters set expandtab + diff --git a/icinga2/files/icingaweb2.jinja b/icinga2/files/icingaweb2.jinja new file mode 100644 index 0000000..932b15d --- /dev/null +++ b/icinga2/files/icingaweb2.jinja @@ -0,0 +1,23 @@ +server { + +server_name icinga.keiran.us; + +rewrite ^/$ http://icinga.keiran.us/icingaweb2 permanent; + + location ~ ^/icingaweb2/index\.php(.*)$ { + # fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/var/run//php/php7.0-fpm.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb2/public/index.php; + fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb2; + fastcgi_param REMOTE_USER $remote_user; + } + + location ~ ^/icingaweb2(.+)? { + alias /usr/share/icingaweb2/public; + index index.php; + try_files $1 $uri $uri/ /icingaweb2/index.php$is_args$args; + } + +} diff --git a/icinga2/init.sls b/icinga2/init.sls index e545696..97e5400 100644 --- a/icinga2/init.sls +++ b/icinga2/init.sls @@ -1,4 +1,39 @@ -'icinga2': - pkg.installed: [] +icinga_packages: + pkg.installed: + - pkgs: + - icinga2 + - icingaweb2 + +apache2: + service.dead: + - enable: False + - require_by: + - pkg: nginx + file.absent: + - name: /etc/apache2 + +icingaweb2_vhost: + file.managed: + - name: /etc/nginx/sites-enabled/icingaweb2 + - source: 'salt://icinga2/files/icingaweb2.jinja' + - template: jinja + - user: root + - group: root + - require: + - pkg: nginx + - watch_by: + - service: nginx + +# icingacli setup config directory +# icingacli setup token create +# icingacli setup token show +# visit /icingaweb2/setup + +icingaweb2_enable: + file.symlink: + - name: /etc/nginx/sites-enabled/icingaweb2 + - target: /etc/nginx/sites-available/icingaweb2 + - watch_by: + - service: nginx diff --git a/nginx/init.sls b/nginx/init.sls new file mode 100644 index 0000000..15e461b --- /dev/null +++ b/nginx/init.sls @@ -0,0 +1,43 @@ + +nginx: + pkg.installed: + - name: nginx-light + service.running: + - enable: True + - reload: True + +{% if salt.pillar.get('use_php', True) %} + +{% set timezone = salt.timezone.get_zone() %} + +php-fpm: + pkg.installed: [] + service.running: + - name: php7.0-fpm + - enable: True + - watch: + - file: php_cgi.fixpathinfo=1 + - file: php_date.timezone={{ timezone }} + +php_cgi.fixpathinfo=1: + file.uncomment: + - name: /etc/php/7.0/fpm/php.ini + - char: ; + - regex: cgi\.fix\_pathinfo\=1 + +php_date.timezone={{ timezone }}: + file.replace: + - name: /etc/php/7.0/fpm/php.ini + - append_if_not_found: True + - pattern: \;date\.timezone.* + - repl: date.timezone = {{ timezone }} + +{% endif %} + +/var/www/html/index.html: + file.managed: + - user: root + - group: root + - mode: 644 + - contents: '' + diff --git a/ssh/files/bashrc.jinja b/ssh/files/bashrc.jinja index cc384c5..a8394b1 100644 --- a/ssh/files/bashrc.jinja +++ b/ssh/files/bashrc.jinja @@ -18,10 +18,6 @@ export PROMPT_COMMAND='history -a' shopt -s histappend shopt -s checkwinsize -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar - # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" diff --git a/top.sls b/top.sls index 9df86e3..440de78 100644 --- a/top.sls +++ b/top.sls @@ -8,3 +8,4 @@ 'kpi.keiran.us': - salt.master - icinga2 + - nginx