Hi Michael,
You could into the $PIPE lookup plugin
$PIPE(some command here)
so
vars:
timestamp: $PIPE(date +%Y%m%d%H%M%S)
path_1: /app/releases/${timestamp}-v1.0/ROOT
path_2: /app/config/${timestamp}-v2.3.1
path_3: ${path_2}/properties
would work? That would be great!
The only downside is it will be evaluated a *lot*, work to make this
be evaluated outside of the multiprocessing loop can be done to make
it convert to variables earlier, but I must say including a variable
file based on the time and date seems
a little complicated to me.
The documentation says:
"... and if it is used in a variable definition, it will be executed each time the variable is evaluated"
Does this mean that it would be called twice per server in the example above and there would be the possiblity of different values for 'timestamp'?
This would be ok for my use case I think. It is not essential that those timestamps are equal.
I just need them to sort the folder names.
Can I ask what the underlying use case is?
Sure. I'm deploying using Ansible to deploy webapps and webservices to our tomcat instances.
The main steps of the workflow are:
1. download artifact (zip containing application war and configuration jar) from Nexus into tmp folder /app/tmp and unpack
2. unpack war to /app/releases/20130322201903-v1.0/ROOT
3. create/change symlink /app/current_app to point to /app/releases/20130322201903-v1.0
4. unpack jar to /app/config/20130322201904-v2.3.1
5. create/change symlink /app/current_config to /app/config/20130322201904-v2.3.1
4. delete /app/tmp
5. restart tomcat
In case of an error i would do a rollback by just changing the symlinks to point to the folders to which they were linked before by reverse sorting the folder names.
As I understand capistrano uses a similar mechanism like this to have a fast and secure rollback.
Maybe I'm getting it all wrong. So please feel free to make suggestions
Regards,
Clifford
Regards,