From 65c2b869f507e27f99ef9ec595f3124b75f9c055 Mon Sep 17 00:00:00 2001 From: Jakub Filo Date: Tue, 23 May 2023 18:38:39 +0000 Subject: [PATCH] My very first Salt states :) --- salt/srv/pillar/base/motd/init.sls | 1 + salt/srv/pillar/base/top.sls | 7 +++++++ salt/srv/salt/base/docker/init.sls | 15 +++++++++++++++ salt/srv/salt/base/locale/init.sls | 8 ++++++++ salt/srv/salt/base/top.sls | 14 ++++++++++++++ salt/srv/salt/base/util/init.sls | 7 +++++++ 6 files changed, 52 insertions(+) create mode 100644 salt/srv/pillar/base/motd/init.sls create mode 100644 salt/srv/pillar/base/top.sls create mode 100644 salt/srv/salt/base/docker/init.sls create mode 100644 salt/srv/salt/base/locale/init.sls create mode 100644 salt/srv/salt/base/top.sls create mode 100644 salt/srv/salt/base/util/init.sls diff --git a/salt/srv/pillar/base/motd/init.sls b/salt/srv/pillar/base/motd/init.sls new file mode 100644 index 0000000..a922aaf --- /dev/null +++ b/salt/srv/pillar/base/motd/init.sls @@ -0,0 +1 @@ +env-name: base diff --git a/salt/srv/pillar/base/top.sls b/salt/srv/pillar/base/top.sls new file mode 100644 index 0000000..1b718ba --- /dev/null +++ b/salt/srv/pillar/base/top.sls @@ -0,0 +1,7 @@ +base: + '*': + - motd + +prod: + '*': + - motd diff --git a/salt/srv/salt/base/docker/init.sls b/salt/srv/salt/base/docker/init.sls new file mode 100644 index 0000000..a9a604a --- /dev/null +++ b/salt/srv/salt/base/docker/init.sls @@ -0,0 +1,15 @@ +Install and start Docker: + pkg.installed: + - pkgs: + - docker.io + pip.installed: + - name: docker + service.running: + - name: docker + +{% for vhost,config in pillar["vhosts"].items() %} +Create docker network-{{ vhost }}: + docker_network.present: + - name: network-{{ vhost }} + - internal: False +{% endfor %} \ No newline at end of file diff --git a/salt/srv/salt/base/locale/init.sls b/salt/srv/salt/base/locale/init.sls new file mode 100644 index 0000000..7d8cd1a --- /dev/null +++ b/salt/srv/salt/base/locale/init.sls @@ -0,0 +1,8 @@ +/etc/default/locale: # May be absent + file.managed # so create it if any + +en_US.UTF-8: + locale.present + +C.UTF-8: + locale.system diff --git a/salt/srv/salt/base/top.sls b/salt/srv/salt/base/top.sls new file mode 100644 index 0000000..a35b257 --- /dev/null +++ b/salt/srv/salt/base/top.sls @@ -0,0 +1,14 @@ +base: + '*': + - util + - locale + +prod: + '*': + - docker + - mariadb + - elasticsearch + - php-fpm-docker + - magento + - nginx-docker + - memcached-docker diff --git a/salt/srv/salt/base/util/init.sls b/salt/srv/salt/base/util/init.sls new file mode 100644 index 0000000..48cb211 --- /dev/null +++ b/salt/srv/salt/base/util/init.sls @@ -0,0 +1,7 @@ +util: + pkg.installed: + - pkgs: + - vim + - curl + - wget + - htop