*Project 01 Base:* /data/salt/project01
*Project 02 Base:* /data/salt/project02
file_roots:
base:
- /data/salt/states
project01:
- /data/salt/project01
project02:
- /data/salt/project02
/data
└── salt
├── states
<=========== Is it possible to make "base" as centralized stuff?
│ ├── appserver
│ │ ├── tomcat
│ │ │ └── init.sls
│ │ └── weblogic
│ │ └── init.sls
│ ├── common
│ │ └── init.sls
│ ├── webserver
│ │ ├── apache
│ │ │ └── init.sls
│ │ ├── lighttpd
│ │ │ └── init.sls
│ │ └── nginx
│ │ └── init.sls
│ ├── database
│ │ ├── mariadb
│ │ │ └── init.sls
│ │ ├── mysql
│ │ │ └── init.sls
│ │ └── oracle
│ │ └── init.sls
│ ├── top.sls <======= Is it
possible to include all project (Project01, Project01 , .. Project0n) in
top.sls?
│ ├── project01-prd.sls <======= Is it
possible to add Project01 Production related minions entry in this file?
│ ├── project01-ppd.sls <======= Is it
possible to add Project01 Pre-production related minions entry in this
file?
│ ├── project02-prd.sls <======= Is it
possible to add Project02 Production related minions entry in this file?
├── project02-ppd.sls <======= Is it
possible to add Project02 Pre-production related minions entry in thisfile?
├── project01
│ ├── preprod
│ │ ├── states
│ │ │ ├── webserver
│ │ │ │ └── apache
│ │ │ │ └── init.sls <======= Is
it possible to include it from base state webserver.apache and override Id
declaration/Names declaration and add extra things that project require?
│ │ │ ├── appserver
│ │ │ │ └── tomcat
│ │ │ │ └── init.sls <======= Is
it possible to include it from base state appserver.tomcat and override Id
declaration/Names declaration and add extra things that project require?
│ │ │ ├── common
└── init.sls
│ │ └── pillar
│ └── prod
│ ├── states
│ │ ├── webserver
│ │ │ └── apache
│ │ │ └── init.sls <=======
same as above
│ │ └── appserver
│ │ └── tomcat
│ │ └── init.sls <=======
same as above
│ └── pillar
├── project02
│ ├── preprod
│ │ ├── states
│ │ │ ├── webserver
│ │ │ │ └── nginx
│ │ │ │ └── init.sls <=======
same as above
│ │ │ ├── database
│ │ │ │ └── mysql
│ │ │ │ └── init.sls <=======
same as above
│ │ │ ├── appserver
│ │ │ │ └── tomcat
│ │ │ │ └── init.sls <=======
same as above
│ │ │ ├── common
│ │ │ └── tools
│ │ └── pillar
│ └── prod
│ ├── states
│ │ ├── database
│ │ │ └── mysql
│ │ │ └── init.sls <=======
same as above
│ │ ├── tools
│ │ │ └── init.sls
│ │ ├── webserver
│ │ │ └── nginx
│ │ │ └── init.sls <=======
same as above
│ │ └── appserver
│ │ └── tomcat
│ │ └── init.sls <=======
same as above
│ └── pillar
└── Pillar
Here I want to create a base as centralized stuff of software's and
configurations. If project has some extra thing to add in software it will
add or override the salt id/name.
So I was trying the same thing here but seems not working for me, I thing
doing some silly mistake, as I'm newbie to salt.
*Here my base is:*
file_roots:
base:
- /data/salt/states
project01:
- /data/salt/project01
*vim /data/salt/states/webserver/nginx/init.sls*
# Installing package and service
nginx:
pkg:
- installed
service:
- running
- enable: True
- require:
- pkg: nginx
- watch:
- file: /etc/nginx/conf.d/vhost.conf
# Installing virtual hosts
/etc/nginx/conf.d/vhost.conf:
file.managed:
- source: salt://webserver/nginx/files/vhost.conf.j2
- template: jinja
/etc/nginx/conf.d/proxy_params.conf:
file.managed:
- source: salt://webserver/nginx/files/proxy_params.conf
*vim /data/salt/project01/webserver/nginx/init.sls*
include:
- base: webserver.nginx
extend:
/etc/nginx/conf.d/vhost.conf:
file.managed:
- source: salt://webserver/nginx/files/vhost.conf.j2
- template: jinja
*vim /data/salt/states/top.sls*
project01:
'apps*.dev.project01*':
- webserver.nginx
'apps*.dev.project01*':
- webserver.nginx
Here I want to override/extends "/etc/nginx/conf.d/vhost.conf" salt ID, but
it doesn't take the Jinja file from project01 (
/data/salt/project01/webserver/nginx/files/vhost.conf.j2) .
It takes the file from jinja file from (
/data/salt/states/webserver/nginx/files/vhost.conf.j2), What changes should
I do so that it will consider Jinja file from project01 (
/data/salt/project01/webserver/nginx/files/vhost.conf.j2) and not the
default one.
*Some more question: *
1) Is it possible to run highstate for project01 only, like "salt '*'
state.highstate --top = project01-ppd.sls"?
2) For one project there are 2 environment running one is Pre-production
and other is production, for that now I have created 2 states
file_roots:
base:
- /data/salt/states
project01-ppd:
- /data/salt/project01-ppd
project01-prd:
- /data/salt/project01-prd
base:
- /data/salt/states
project01-ppd:
- /data/salt/project01-ppd
project01-prd:
- /data/salt/project01-prd
Here we have written same states for pre-production and production, excepts
few differences like pillar MySQL database user and password, because they
are different in pre-production and production. Is there any way to write
state once for pre-production and production and use pillar values
according to their environment?
Thanks
--Pankaj
--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.