This could probably be done much better so any advice is welcome. I have a file called “deploy_list” inside the “group_vars” folder. It’s a list of modules that needs to be deployed. During any given deploy, the deployment person lists the modules he wishes to deploy. The list of modules differs for each deploy so the file is dynamic.
Without having to pass “–tags=perl” if he knows only PERL modules are being deployed, I would rather have the script skip the PHP tasks if no variables are set. See below … this would fail w/ the following msg.
TASK: [Export PHP code from SVN] **********************************************
fatal: [127.0.0.1] => with_dict expects a dict
cat deploy_list
deploy_php_modules:
deploy_perl_modules:
module_name:
tag: ‘20140514r1_6.21_Amadeus’
svn_path: ‘/projects/module_name’
document_root: ‘/tmp’
cat site.yml
- hosts: 127.0.0.1
gather_facts: no
connection: local
user: deployment
vars_files:
- “group_vars/deploy_list”
tasks:
-
name: Export PHP code from SVN
action: shell svn export {{ item.value.svn_path }} {{ item.value.document_root }}
with_dict: deploy_php_modules
tags: php -
name: Export PERL code from SVN
action: shell svn export {{ item.value.svn_path }} {{ item.value.document_root }}
with_dict: deploy_perl_modules
tags: perl