2020-11-29 21:10:42 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Ensure facts are gathered
|
|
|
|
ansible.builtin.setup:
|
|
|
|
|
|
|
|
- name: Ensure Ansible version is captured
|
2021-04-10 13:15:51 +02:00
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: ansible --version
|
2020-11-29 21:10:42 +01:00
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
|
|
|
register: check_ansible_version
|
|
|
|
delegate_to: localhost
|
|
|
|
run_once: true
|
|
|
|
become: false
|
|
|
|
|
|
|
|
- name: Ensure Ansible config is captured
|
2021-04-10 13:15:51 +02:00
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: ansible-config dump --only-changed
|
2020-11-29 21:10:42 +01:00
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
|
|
|
register: check_ansible_config
|
|
|
|
delegate_to: localhost
|
|
|
|
run_once: true
|
|
|
|
become: false
|
|
|
|
|
2020-11-30 22:56:24 +01:00
|
|
|
- name: Ensure a list of roles is captured
|
2021-04-10 13:15:51 +02:00
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: ansible-galaxy role list
|
2020-11-30 22:56:24 +01:00
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
|
|
|
register: check_ansible_roles
|
|
|
|
delegate_to: localhost
|
|
|
|
run_once: true
|
|
|
|
become: false
|
|
|
|
|
2020-11-29 21:10:42 +01:00
|
|
|
- name: Ensure facts are written to disk
|
|
|
|
ansible.builtin.copy:
|
2020-12-21 20:14:52 +01:00
|
|
|
dest: "{{ playbook_dir }}/pyratlabs-issue-dump.txt"
|
2020-11-29 21:10:42 +01:00
|
|
|
content: |
|
|
|
|
# Begin ANSIBLE VERSION
|
|
|
|
{{ check_ansible_version.stdout }}
|
|
|
|
# End ANSIBLE VERSION
|
|
|
|
|
|
|
|
# Begin ANSIBLE CONFIG
|
|
|
|
{{ check_ansible_config.stdout }}
|
|
|
|
# End ANSIBLE CONFIG
|
|
|
|
|
2020-11-30 22:56:24 +01:00
|
|
|
# Begin ANSIBLE ROLES
|
|
|
|
{{ check_ansible_roles.stdout }}
|
|
|
|
# End ANSIBLE ROLES
|
|
|
|
|
2020-11-29 21:10:42 +01:00
|
|
|
# Begin PLAY HOSTS
|
2021-07-24 18:21:31 +02:00
|
|
|
{{ ansible_play_hosts | to_json }}
|
2020-11-29 21:10:42 +01:00
|
|
|
# End PLAY HOSTS
|
|
|
|
|
|
|
|
# Begin K3S ROLE CONFIG
|
2021-07-24 18:21:31 +02:00
|
|
|
{% for host in ansible_play_hosts %}
|
2020-11-29 21:10:42 +01:00
|
|
|
## {{ host }}
|
2020-12-21 20:14:52 +01:00
|
|
|
{% for config_key in hostvars[host] %}
|
|
|
|
{% if config_key | regex_search('^k3s_') %}
|
2020-11-29 21:10:42 +01:00
|
|
|
{{ config_key }}: {{ hostvars[host][config_key] | to_json }}
|
2020-12-21 20:14:52 +01:00
|
|
|
{% endif %}
|
2020-11-29 21:10:42 +01:00
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% endfor %}
|
|
|
|
# End K3S ROLE CONFIG
|
|
|
|
|
|
|
|
# Begin K3S RUNTIME CONFIG
|
2021-07-24 18:21:31 +02:00
|
|
|
{% for host in ansible_play_hosts %}
|
2020-11-29 21:10:42 +01:00
|
|
|
## {{ host }}
|
2020-12-21 20:14:52 +01:00
|
|
|
{% if hostvars[host].k3s_runtime_config is defined %}
|
2020-11-29 21:10:42 +01:00
|
|
|
{{ hostvars[host].k3s_runtime_config }}
|
2020-12-21 20:14:52 +01:00
|
|
|
{% endif %}
|
2020-11-29 21:10:42 +01:00
|
|
|
{% endfor %}
|
|
|
|
# End K3S RUNTIME CONFIG
|
|
|
|
mode: 0600
|
|
|
|
delegate_to: localhost
|
|
|
|
run_once: true
|
|
|
|
become: false
|
|
|
|
|
|
|
|
- name: Fail the play
|
|
|
|
ansible.builtin.fail:
|
2021-06-22 21:47:58 +02:00
|
|
|
msg: >-
|
|
|
|
Please include the output of
|
|
|
|
{{ playbook_dir }}/pyratlabs-issue-dump.txt in your bug report.
|
2020-11-29 21:10:42 +01:00
|
|
|
delegate_to: localhost
|
|
|
|
run_once: true
|