1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 19:22:24 +00:00
iiab/test.yml

78 lines
2.2 KiB
YAML
Raw Normal View History

# 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 Munin description
debug:
msg: '"''"' # FAILS: '"\'"'
- name: BACKSLASH to escape double quotes... "'\"'" e.g. cups/tasks/install.yml
debug:
msg: "'\"'" # FAILS: "'""'"
2021-10-29 04:11:56 +00:00
- 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:
b:
c: # Space
2021-10-29 04:11:56 +00:00
#d: # Tab
e: ''
f: ""
- debug:
var: a
- debug:
var: b
- debug:
var: c
- debug:
var: d
- debug:
var: e
- debug:
var: f
- 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
# TEST ANSIBLE COMMANDS/MODULES HERE!