
문서에 따르면 다음을 사용하면
salt_top_saltenv: base
마스터 구성에서 모든 미니언이 다른 모든 상위 파일을 무시하고 상위 파일에 대해 기본 saltenv만 사용하도록 강제할 수 있다는 것이 맞습니까?
state_top_saltenv를 base로 설정하면 기본 최상위 파일에 있는 모든 환경의 모든 상태가 적용되고 다른 모든 최상위 파일은 무시됩니다.
Gitfs를 백엔드로 사용하려고 하는데 어떤 것과도 일치하지 않는 이상한 결과(state.show_top)가 나타납니다.
나는 다음과 같은 구성을 가지고 있습니다
- 단일 Git 저장소
- 4x 심판, 베이스, 개발, 스테이징, 프로덕션
최상위 파일에 대한 단일 참조(기본)를 얻은 다음 각 환경의 상태를 얻으려고 합니다. 그런 다음 병합을 통해 환경을 통해 변경 사항을 홍보하고 top.sls를 최대한 정적으로 유지하려고 노력할 수 있습니다.
##### Salt Master config #####
salt_top_saltenv: base
top_file_merging_strategy: same
gitfs_base: base
gitfs_saltenv:
- base:
- ref: base
- development:
- ref: development
- staging:
- ref: staging
- production:
- ref: production
gitfs_remotes:
# Salt States
- ssh://[email protected]/Salt.git:
- name: salt
- root: states
- mountpoint: salt://
##### How the repo is laid out #####
# Base Branch
README.md
.gitignore
states/top.sls
# Development Branch
README.md
.gitignore
states/Test/init.sls
# Staging Branch
README.md
.gitignore
states/Test/init.sls
# Production Branch
README.md
.gitignore
states/Test/init.sls
##### Top.sls #####
{# The saltenv variable represents the environment the Minion is configured
to #}
{{ saltenv }}:
'*':
# Apply states.test to everything from the matching env
{%- do salt.log.info("Applying Salt states.test from" + saltenv +
"environment" ) %}
- states.Test
##### Example Minion config ######
master: salt-master.mydomain.com
saltenv: development
From the Minion I am able to list the files on the Master correctly as
expected
# Not specifying the saltenv results in the base being used
sudo salt '*' cp.list_master
top.sls
# Specifying the Base saltenv
sudo salt '*' cp.list_master saltenv=base
top.sls
# Specifying the Development saltenv
sudo salt '*' cp.list_master saltenv=development
Test/init.sls
가장 일치하는 항목을 표시하려고 하면 Salt가 예상한 대로 Base 대신 개발 환경을 찾고 있습니다.
sudo salt-call state.show_top --log-level=debug
[DEBUG ] Could not find file 'salt://top.sls' in saltenv 'development'
[DEBUG ] No contents found in top file. If this is not expected, verify that the 'file_roots' specified in 'etc/mas
ter' are accessible. The 'file_roots' configuration is: {'production': [], 'development': [], 'staging': [], 'base':
[]}
[ERROR ] The 'development' saltenv has no top file, and the fallback saltenv specified by default_top (base) also h
as no top file
[DEBUG ] Could not find file 'salt://top.sls' in saltenv 'development'
[DEBUG ] No contents found in top file. If this is not expected, verify that the 'file_roots' specified in 'etc/mas
ter' are accessible. The 'file_roots' configuration is: {'production': [], 'development': [], 'staging': [], 'base':
[]}
[ERROR ] The 'development' saltenv has no top file, and the fallback saltenv specified by default_top (base) also h
as no top file
[DEBUG ] Could not find file 'salt://top.sls' in saltenv 'development'
[DEBUG ] No contents found in top file. If this is not expected, verify that the 'file_roots' specified in 'etc/mas
ter' are accessible. The 'file_roots' configuration is: {'production': [], 'development': [], 'staging': [], 'base':
[]}
[ERROR ] The 'development' saltenv has no top file, and the fallback saltenv specified by default_top (base) also has no top file
그렇다면 Base에서 단일 top.sls를 달성하고 saltenv에서 다른 모든 상태를 달성하는 가장 좋은 방법은 무엇입니까?
건배.