fix job run
This commit is contained in:
parent
2f21245787
commit
55ffb7055c
36
ansible/Jenkinsfile
vendored
36
ansible/Jenkinsfile
vendored
@ -49,39 +49,37 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def selectedHosts
|
def selectedHosts
|
||||||
|
def extraVars = [
|
||||||
|
ansible_ssh_private_key_file: env.DECYPTED_KEY_FILE
|
||||||
|
]
|
||||||
|
|
||||||
switch(params.DEPLOY_TARGET) {
|
switch(params.DEPLOY_TARGET) {
|
||||||
case 'SiteA':
|
case 'SiteA':
|
||||||
selectedHosts = 'SiteA,proxy'
|
selectedHosts = 'SiteA,proxy'
|
||||||
|
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT_SITEA_H2
|
||||||
|
extraVars.siteA_p = params.ADDITIONAL_CONTENT_SITEA_P
|
||||||
|
extraVars.siteB_h2 = null
|
||||||
|
extraVars.siteB_p = null
|
||||||
break
|
break
|
||||||
case 'SiteB':
|
case 'SiteB':
|
||||||
selectedHosts = 'SiteB,proxy'
|
selectedHosts = 'SiteB,proxy'
|
||||||
|
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT_SITEB_H2
|
||||||
|
extraVars.siteB_p = params.ADDITIONAL_CONTENT_SITEB_P
|
||||||
|
extraVars.siteA_h2 = null
|
||||||
|
extraVars.siteA_p = null
|
||||||
break
|
break
|
||||||
case 'All':
|
case 'All':
|
||||||
selectedHosts = 'SiteA,SiteB,proxy'
|
selectedHosts = 'SiteA,SiteB,proxy'
|
||||||
|
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT_ALL_H2
|
||||||
|
extraVars.siteA_p = params.ADDITIONAL_CONTENT_ALL_P
|
||||||
|
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT_ALL_H2
|
||||||
|
extraVars.siteB_p = params.ADDITIONAL_CONTENT_ALL_P
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
error "Неизвестный DEPLOY_TARGET: ${params.DEPLOY_TARGET}"
|
error "Неизвестный DEPLOY_TARGET: ${params.DEPLOY_TARGET}"
|
||||||
}
|
}
|
||||||
|
|
||||||
def extraVars = [
|
extraVars = extraVars.findAll { key, value -> value != null }
|
||||||
ansible_ssh_private_key_file: env.DECYPTED_KEY_FILE
|
|
||||||
]
|
|
||||||
|
|
||||||
if (params.DEPLOY_TARGET == 'All') {
|
|
||||||
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT_ALL_H2
|
|
||||||
extraVars.siteA_p = params.ADDITIONAL_CONTENT_ALL_P
|
|
||||||
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT_ALL_H2
|
|
||||||
extraVars.siteB_p = params.ADDITIONAL_CONTENT_ALL_P
|
|
||||||
} else {
|
|
||||||
if (params.DEPLOY_TARGET == 'SiteA' || params.DEPLOY_TARGET == 'All') {
|
|
||||||
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT_SITEA_H2
|
|
||||||
extraVars.siteA_p = params.ADDITIONAL_CONTENT_SITEA_P
|
|
||||||
}
|
|
||||||
if (params.DEPLOY_TARGET == 'SiteB' || params.DEPLOY_TARGET == 'All') {
|
|
||||||
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT_SITEB_H2
|
|
||||||
extraVars.siteB_p = params.ADDITIONAL_CONTENT_SITEB_P
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ansiblePlaybook(
|
ansiblePlaybook(
|
||||||
playbook: 'ansible/playbook.yml',
|
playbook: 'ansible/playbook.yml',
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
siteA_h2: "Дефолтный заголовок H2 для SiteA"
|
||||||
|
siteA_p: "Дефолтный параграф для SiteA"
|
||||||
|
|
||||||
|
siteB_h2: "Дефолтный заголовок H2 для SiteB"
|
||||||
|
siteB_p: "Дефолтный параграф для SiteB"
|
||||||
|
|
||||||
siteA:
|
siteA:
|
||||||
site_title: "SiteA - Добро пожаловать"
|
site_title: "SiteA - Добро пожаловать"
|
||||||
site_h1: "Добро пожаловать на SiteA"
|
site_h1: "Добро пожаловать на SiteA"
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
upstream backend {
|
upstream backend {
|
||||||
{% for server in upstream_servers %}
|
{% if siteA.site_ip %}
|
||||||
server {{ server }} max_fails=1 fail_timeout=10s;
|
server {{ siteA.site_ip }} max_fails=1 fail_timeout=10s;
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
|
{% if siteB.site_ip %}
|
||||||
|
server {{ siteB.site_ip }} max_fails=1 fail_timeout=10s;
|
||||||
|
{% endif %}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
Loading…
Reference in New Issue
Block a user