| 1 |
--- |
| 2 |
- name: 'A play with unicode: ¢ £ ¤ ¥' |
| 3 |
hosts: localhost |
| 4 |
vars: |
| 5 |
test_var: 'Ī ī Ĭ ĭ Į į İ ı IJ ij Ĵ ĵ Ķ ķ ĸ Ĺ ĺ Ļ ļ Ľ ľ Ŀ ŀ Ł ł Ń ń Ņ ņ Ň ň ʼn Ŋ ŋ Ō ō Ŏ ŏ Ő ő Œ' |
| 6 |
hostnames: |
| 7 |
- 'host-ϬϭϮϯϰ' |
| 8 |
- 'host-fóöbär' |
| 9 |
- 'host-ΙΚΛΜΝΞ' |
| 10 |
- 'host-στυφχψ' |
| 11 |
- 'host-ϬϭϮϯϰϱ' |
| 12 |
|
| 13 |
tasks: |
| 14 |
- name: 'A task name with unicode: è é ê ë' |
| 15 |
debug: msg='hi there' |
| 16 |
|
| 17 |
- name: 'A task with unicode parameters' |
| 18 |
debug: var=test_var |
| 19 |
|
| 20 |
# € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ˜ ™ š › œ ž Ÿ ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ®' |
| 21 |
|
| 22 |
- name: 'A task using with_items containing unicode' |
| 23 |
debug: msg='{{item}}' |
| 24 |
with_items: |
| 25 |
- '¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö ×' |
| 26 |
- 'Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ Ā' |
| 27 |
- 'ā Ă ă Ą ą Ć ć Ĉ ĉ Ċ ċ Č č Ď ď Đ đ Ē ē Ĕ ĕ Ė ė Ę ę Ě ě Ĝ ĝ Ğ ğ Ġ ġ Ģ ģ Ĥ ĥ Ħ ħ Ĩ ĩ' |
| 28 |
|
| 29 |
- add_host: |
| 30 |
name: '{{item}}' |
| 31 |
groups: 'ĪīĬĭ' |
| 32 |
ansible_ssh_host: 127.0.0.1 |
| 33 |
ansible_connection: local |
| 34 |
ansible_python_interpreter: "{{ ansible_playbook_python }}" |
| 35 |
with_items: "{{ hostnames }}" |
| 36 |
|
| 37 |
- name: 'A task with unicode extra vars' |
| 38 |
debug: var=extra_var |
| 39 |
|
| 40 |
- name: 'A task with unicode host vars' |
| 41 |
debug: var=unicode_host_var |
| 42 |
|
| 43 |
- name: 'A task with unicode shell parameters' |
| 44 |
shell: echo '¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö ×' |
| 45 |
register: output |
| 46 |
|
| 47 |
- name: 'Assert that the unicode was echoed' |
| 48 |
assert: |
| 49 |
that: |
| 50 |
- "'¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö ×' in output.stdout_lines" |
| 51 |
|
| 52 |
- name: Run raw with non-ascii options |
| 53 |
raw: "/bin/echo Zażółć gęślą jaźń" |
| 54 |
register: results |
| 55 |
|
| 56 |
- name: Check that raw output the right thing |
| 57 |
assert: |
| 58 |
that: |
| 59 |
- "'Zażółć gęślą jaźń' in results.stdout_lines" |
| 60 |
|
| 61 |
- name: Run a script with non-ascii options and environment |
| 62 |
script: unicode-test-script --option "Zażółć gęślą jaźń" |
| 63 |
environment: |
| 64 |
option: Zażółć |
| 65 |
register: results |
| 66 |
|
| 67 |
- name: Check that script output includes the nonascii arguments and environment values |
| 68 |
assert: |
| 69 |
that: |
| 70 |
- "'--option Zażółć gęślą jaźń' in results.stdout_lines" |
| 71 |
- "'Zażółć' in results.stdout_lines" |
| 72 |
|
| 73 |
- name: Ping with non-ascii environment variable and option |
| 74 |
ping: |
| 75 |
data: "Zażółć gęślą jaźń" |
| 76 |
environment: |
| 77 |
option: Zażółć |
| 78 |
register: results |
| 79 |
|
| 80 |
- name: Check that ping with non-ascii data was correct |
| 81 |
assert: |
| 82 |
that: |
| 83 |
- "'Zażółć gęślą jaźń' == results.ping" |
| 84 |
|
| 85 |
- name: Command that echoes a non-ascii env var |
| 86 |
command: "echo $option" |
| 87 |
environment: |
| 88 |
option: Zażółć |
| 89 |
register: results |
| 90 |
|
| 91 |
- name: Check that a non-ascii env var was passed to the command module |
| 92 |
assert: |
| 93 |
that: |
| 94 |
- "'Zażółć' in results.stdout_lines" |
| 95 |
|
| 96 |
- name: Clean a temp directory |
| 97 |
file: |
| 98 |
path: /var/tmp/ansible_test_unicode_get_put |
| 99 |
state: absent |
| 100 |
|
| 101 |
- name: Create a temp directory |
| 102 |
file: |
| 103 |
path: /var/tmp/ansible_test_unicode_get_put |
| 104 |
state: directory |
| 105 |
|
| 106 |
- name: Create a file with a non-ascii filename |
| 107 |
file: |
| 108 |
path: /var/tmp/ansible_test_unicode_get_put/Zażółć |
| 109 |
state: touch |
| 110 |
delegate_to: localhost |
| 111 |
|
| 112 |
- name: Put with unicode filename |
| 113 |
copy: |
| 114 |
src: /var/tmp/ansible_test_unicode_get_put/Zażółć |
| 115 |
dest: /var/tmp/ansible_test_unicode_get_put/Zażółć2 |
| 116 |
|
| 117 |
- name: Fetch with unicode filename |
| 118 |
fetch: |
| 119 |
src: /var/tmp/ansible_test_unicode_get_put/Zażółć2 |
| 120 |
dest: /var/tmp/ansible_test_unicode_get_put/ |
| 121 |
|
| 122 |
- name: Clean a temp directory |
| 123 |
file: |
| 124 |
path: /var/tmp/ansible_test_unicode_get_put |
| 125 |
state: absent |
| 126 |
|
| 127 |
- name: 'A play for hosts in group: ĪīĬĭ' |
| 128 |
hosts: 'ĪīĬĭ' |
| 129 |
gather_facts: true |
| 130 |
tasks: |
| 131 |
- debug: msg='Unicode is a good thing ™' |
| 132 |
- debug: msg=АБВГД |
| 133 |
|
| 134 |
# Run this test by adding to the CLI: -e start_at_task=True --start-at-task '*¶' |
| 135 |
- name: 'Show that we can skip to unicode named tasks' |
| 136 |
hosts: localhost |
| 137 |
gather_facts: false |
| 138 |
vars: |
| 139 |
flag: 'original' |
| 140 |
start_at_task: False |
| 141 |
tasks: |
| 142 |
- name: 'Override flag var' |
| 143 |
set_fact: flag='new' |
| 144 |
|
| 145 |
- name: 'A unicode task at the end of the playbook: ¶' |
| 146 |
assert: |
| 147 |
that: |
| 148 |
- 'flag == "original"' |
| 149 |
when: start_at_task|bool |