Last active
January 17, 2025 12:34
-
-
Save halberom/794c06598f40ccc31560 to your computer and use it in GitHub Desktop.
Revisions
-
Gerard Lynch revised this gist
Nov 7, 2017 . 2 changed files with 11 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,14 @@ {# style 1 - long form #} {% if filepath == '/var/opt/tomcat_1' %} {% set tomcat_value = tomcat_1_value %} {% else %} {% set tomcat_value = tomcat_2_value %} {% endif %} {# style 2 - short form #} {% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %} {# style 3 - with ternary filter #} {% set tomcat_value = (filepath == '/var/opt/tomcat_1')|ternary(tomcat_1_value, tomcat_2_value) %} <Server port={{ tomcat_value }} shutdown="SHUTDOWN"> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,10 +6,10 @@ tasks: # style 1 using filter - set_fact: tomcat_value: "{{ (filepath == '/var/opt/tomcat_1') | ternary(tomcat_1_value, tomcat_2_value) }}" # style 2 - set_fact: tomcat_value: "{{ tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value }}" - template: -
Gerard Lynch revised this gist
Nov 7, 2017 . 2 changed files with 9 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ {% if filepath == /var/opt/tomcat_1 %} {% set tomcat_value = tomcat_1_value %} {% else %} {% set tomcat_value = tomcat_2_value %} {% endif %} <Server port={{ tomcat_value }} shutdown="SHUTDOWN"> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,13 @@ tomcat_1_value: 'bob' tomcat_2_value: 'bar' tasks: # style 1 using filter - set_fact: tomcat_value: "{{ (filepath == /var/opt/tomcat_1) | ternary(tomcat_1_value, tomcat_2_value) }}" # style 2 - set_fact: tomcat_value: "{{ tomcat_1_value if (filepath == /var/opt/tomcat_1) else tomcat_2_value }}" - template: ... -
Gerard Lynch revised this gist
Jul 29, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ --- - hosts: foo vars: tomcat_1_value: 'bob' tomcat_2_value: 'bar' tasks: - set_fact: tomcat_value: "{{ filepath == /var/opt/tomcat_1 | ternary(tomcat_1_value, tomcat_2_value) }}" -
Gerard Lynch created this gist
Jul 29, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ {% if filepath == /var/opt/tomcat_1 %} {% set tomcat_value == tomcat_1_value %} {% else %} {% set tomcat_value == tomcat_2_value %} {% endif %} <Server port={{ tomcat_value }} shutdown="SHUTDOWN"> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ --- - hosts: foo tasks: - set_fact: tomcat_value: "{{ filepath == /var/opt/tomcat_1 | ternary(tomcat_1_value, tomcat_2_value) }}" - template: ... This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ <Server port={{ tomcat_value }} shutdown="SHUTDOWN">