forked from iiab/iiab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.yml
109 lines (90 loc) · 3.51 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# TEST ANSIBLE COMMANDS/MODULES IN SECONDS -- BY RUNNING:
# ansible-playbook -i ansible_hosts test.yml --connection=local
- hosts: all
become: yes # Optional privilege escalation
#vars_files:
# - roles/0-init/defaults/main.yml
# - vars/default_vars.yml
# - vars/{{ ansible_local.local_facts.os_ver }}.yml
# - /etc/iiab/local_vars.yml
# - /etc/iiab/iiab_state.yml
#roles:
# - { role: 0-init }
tasks:
#- include_role:
# name: 0-init
- debug:
msg: "{{ 'changeme' | password_hash('sha512') }}"
# msg: "{{ 'changeme' | password_hash('yescrypt') }}" # crypt.crypt STILL doesn't support 'yescrypt' algorithm ?
#- pause:
- name: DOUBLE UP to escape single quotes... '"''"' e.g. iiab.ini descriptions for azuracast, captiveportal, mosquitto, munin, nodejs, osm-vector-maps, sshd
debug:
msg: '"''"' # OR: '''' FAILS: '"\'"'
- name: BACKSLASH to escape double quotes... "'\"'" e.g. cups/tasks/install.yml
debug:
msg: "'\"'" # OR: "\"" FAILS: "'""'"
- name: "Entire string must be enclosed in quotes if using ' #' Space-then-Pound/Hash sequence -- or right side will be a comment! e.g. roles/vnstat/install.yml"
debug:
msg: "Left side # Right side"
- name: a shows "VARIABLE IS NOT DEFINED!" -- whereas b (w/o whitespace) AND c (with space) AND d (with tab, STRICTLY DISALLOWED IN YAML BY ansible-core 2.11.6) showed null (without quotes!) -- whereas e (singlequotes) and f (doublequotes) show "" empty string
set_fact:
#a: # Tabs NO LONGER ALLOWED, in strict YAML: https://stackoverflow.com/a/19976827
b:
c: # Space
d: ''
e: ""
f: "3.10" # zero preserved b/c AnsibleUnicode (i.e. string)
g: +03.10 # plus sign & zeros dropped b/c float
- debug:
var: a # "VARIABLE IS NOT DEFINED!"
- debug:
var: a | type_debug # AnsibleUndefined
- debug:
var: b # null
- debug:
var: b | type_debug # NoneType
- debug:
var: c # null
- debug:
var: c | type_debug # NoneType
- debug:
var: d # ""
- debug:
var: d | type_debug # AnsibleUnicode
- debug:
var: e # ""
- debug:
var: e | type_debug # AnsibleUnicode
- debug:
var: f # "3.10"
- debug:
var: f | type_debug # AnsibleUnicode
- debug:
var: g # 3.1
- debug:
var: g | type_debug # float
- debug:
var: ansible_local.local_facts # SEE: /opt/iiab/iiab/scripts/local_facts.fact
- debug:
var: ansible_local.local_facts.os_ver
# Since Ansible 2.7, avoid ansible_distribution: https://github.com/iiab/iiab/pull/3237
# https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#commonly-used-facts
- debug:
var: ansible_facts['distribution'] # ansible_facts.distribution ?
- debug:
var: ansible_facts['os_family'] # ansible_facts.os_family ?
- debug:
var: ansible_facts['distribution_major_version'] # ansible_facts.distribution_major_version ?
- debug:
var: ansible_architecture
- debug:
var: ansible_machine
- command: dpkg --print-architecture
register: cmd
- debug:
msg: "'dpkg --print-architecture' output: {{ cmd.stdout }}"
- command: dpkg --print-foreign-architectures
register: cmd
- debug:
msg: "'dpkg --print-foreign-architectures' output: {{ cmd.stdout }}"
# TEST ANSIBLE COMMANDS/MODULES HERE!