From bc122be13e0e87cf2d775f8c7b5267f0164c8624 Mon Sep 17 00:00:00 2001 From: jonas Date: Fri, 22 Oct 2021 16:19:31 +0200 Subject: [PATCH] . --- salt/states/nginx/files/harvester/.gitignore | 4 ---- salt/states/nginx/files/www.conf | 9 +++++++++ salt/states/nginx/init.sls | 14 ++++++++------ salt/states/pxe/harvester/init.sls | 1 + 4 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 salt/states/nginx/files/harvester/.gitignore create mode 100644 salt/states/nginx/files/www.conf diff --git a/salt/states/nginx/files/harvester/.gitignore b/salt/states/nginx/files/harvester/.gitignore deleted file mode 100644 index 5e7d273..0000000 --- a/salt/states/nginx/files/harvester/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore diff --git a/salt/states/nginx/files/www.conf b/salt/states/nginx/files/www.conf new file mode 100644 index 0000000..e7d4c3a --- /dev/null +++ b/salt/states/nginx/files/www.conf @@ -0,0 +1,9 @@ +server { + listen 80 default; + server_name www.{{ pillar['network']['domain'] }}; + location /{ + root /srv/www/htdocs/; + index index.html; + autoindex on; + } +} diff --git a/salt/states/nginx/init.sls b/salt/states/nginx/init.sls index ee3fe92..a370cfd 100644 --- a/salt/states/nginx/init.sls +++ b/salt/states/nginx/init.sls @@ -2,12 +2,14 @@ Install nginx: pkg.installed: - name: nginx -create www folder structure: - file.recurse: - - name: /srv/www/htdocs - - source: salt://nginx/files - - include_empty: True - - replace: False +configure www configuration: + file.managed: + - name: /etc/nginx/vhosts.d/www.conf + - source: salt://nginx/files/www.conf + - template: jinja + - user: root + - group: root + - mode: "0644" Start nginx: service.running: diff --git a/salt/states/pxe/harvester/init.sls b/salt/states/pxe/harvester/init.sls index c643beb..6a2afcc 100644 --- a/salt/states/pxe/harvester/init.sls +++ b/salt/states/pxe/harvester/init.sls @@ -4,6 +4,7 @@ Download harvester {{ item['version'] }} ISO: - name: /srv/www/htdocs/harvester/harvester-v{{ item['version'] }}-amd64.iso - source: https://releases.rancher.com/harvester/v{{ item['version'] }}/harvester-v{{ item['version'] }}-amd64.iso - source_hash: {{ item['hash']['iso'] }} + - makedirs: True - user: root - group: root - mode: "0644"