0

We recently integrated Ansible deployment with Jenkins. All looks good and the next step is to find a way to store all playbook variables. What is the best practice for that? We want to have different set of variables for each environment (Dev, QA, UAT, Prod). Many thanks.

Peter Hall
  • 53,120
  • 14
  • 139
  • 204
ADS
  • 11
  • 2

1 Answers1

0

Use a shell/batch script and set them as environment variables. Like

#!/bin/bash
export var1=value1
export var2=value2

Then execute the script just before running playbook.

source <script>.sh
bash <script>.sh

You can also parameterize the values which can be passed through jenkins during runtime.i.e

export var1=$1 and so on.....
MMA
  • 408
  • 3
  • 7
  • 19