我们目前在我们的环境中有这个命名约定
template <typename T, T ... Is>
constexpr T add (std::integer_sequence<T, Is...> const & a)
{ return ( Is + ... ); }
作为我的剧本的一部分,我有以下几乎打印abc.dev.example.com ## dev servers
abc.staging.example.com ## staging servers
abc.example.com ### prod servers
abc.dev.example.com
但是当我将env变量留空时,我得到以下 vars:
env: dev
tasks:
- name: show vars
debug: msg=abc.{{env | default([])}}.example.com
。我需要它abc..example.com
。
知道如何在ansible中编写额外的abc.example.com
字符吗?
答案 0 :(得分:3)
你可以这样做:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@5.0.3
3 info using node@v8.1.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle mulibwanji@0.0.0~prestart: mulibwanji@0.0.0
6 silly lifecycle mulibwanji@0.0.0~prestart: no script for prestart, continuing
7 info lifecycle mulibwanji@0.0.0~start: mulibwanji@0.0.0
8 verbose lifecycle mulibwanji@0.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle mulibwanji@0.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/src/app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle mulibwanji@0.0.0~start: CWD: /usr/src/app
11 silly lifecycle mulibwanji@0.0.0~start: Args: [ '-c',
11 silly lifecycle 'npm run build && npm run test-prod && npm run lint && npm run update-schema && node ./bin/www' ]
12 silly lifecycle mulibwanji@0.0.0~start: Returned: code: 139 signal: null
13 info lifecycle mulibwanji@0.0.0~start: Failed to exec start script
14 verbose stack Error: mulibwanji@0.0.0 start: `npm run build && npm run test-prod && npm run lint && npm run update-schema && node ./bin/www`
14 verbose stack Exit status 139
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at EventEmitter.emit (events.js:213:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at ChildProcess.emit (events.js:213:7)
14 verbose stack at maybeClose (internal/child_process.js:897:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
15 verbose pkgid mulibwanji@0.0.0
16 verbose cwd /usr/src/app
17 verbose Linux 4.11.9-coreos
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 verbose node v8.1.3
20 verbose npm v5.0.3
21 error code ELIFECYCLE
22 error errno 139
23 error mulibwanji@0.0.0 start: `npm run build && npm run test-prod && npm run lint && npm run update-schema && node ./bin/www`
23 error Exit status 139
24 error Failed at the mulibwanji@0.0.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 139, true ]
答案 1 :(得分:1)
你可以使你的条件显式而不是依赖于default()
debug: msg=abc.{% if thing is defined %}{{ thing }}.{% else %}{% endif %}example.com