Created
June 13, 2013 15:15
-
-
Save adamreid/5774514 to your computer and use it in GitHub Desktop.
Failed and expression in ansible when clause
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure yum repos based on requirement for stable, | |
# unstable, current, or specific assembly number | |
--- | |
- hosts: test | |
vars: | |
branch: trunk | |
branch_repo: unstable | |
tasks: | |
- name: use unstable repository | |
action: command echo -u | |
register: repo_flag | |
when: branch_repo == 'unstable' | |
- name: use stable repository | |
action: command echo -s | |
register: repo_flag | |
when: branch_repo == 'stable' | |
- name: use current repository | |
action: command echo -s | |
register: repo_flag | |
when: branch_repo == 'current' | |
- name: use latest repository | |
action: command echo -s | |
register: repo_flag | |
when: branch_repo == 'latest' | |
- name: use assembly number | |
action: command echo -a {{ branch_repo['assembly'] }} | |
register: repo_flag | |
when: mapping(branch_repo) and defined(branch_repo['assembly']) | |
- name: show repo configuration | |
action: command echo {{ branch }} {{ branch_repo }} {{ repo_flag }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment