ansible-role-k3s/tasks/validate/environment/local/issue-data.yml
Xan Manning e7c714424c
Tiidy up and refactoring of tasks (#80)
* Tidy up and refactoring of tasks

  - `k3s_config_dir` derived from `k3s_config_file`, reused throughout the role
    to allow for easy removal of "Rancher" references #73.
  - `k3s_token_location` has moved to be in `k3s_config_dir`.
  - Tasks for creating directories now looped to caputure configuration from
    `k3s_server` and `k3s_agent` and ensure directories exist before k3s
    starts, see #75.
  - Server token collected directly from token file, not symlinked file
    (node-token).
  - `k3s_runtime_config` defined in `vars/` for validation and overwritten in
    tasks for control plane and workers.
  - Removed unused references to GitHub API.

* set_fact now uses FQCN

* re-pin molecule<3.2

* Command module now uses FQCN

* Added package checks for #72

* Reorder task files

  - Docker tasks moved into a separate directory for ease of removal #67
  - Bugfix: Control plane on alternate port didn't work.
  - Validation tasks grouped

* Fix Fedora tests

* Add optional documentation links to validations steps #76

* Removed jmespath requirement

* Fix issue with data collection

* Release candidate
2020-12-21 19:14:52 +00:00

83 lines
2.1 KiB
YAML

---
- name: Ensure facts are gathered
ansible.builtin.setup:
- name: Ensure Ansible version is captured
ansible.builtin.command: ansible --version
failed_when: false
changed_when: false
register: check_ansible_version
delegate_to: localhost
run_once: true
become: false
- name: Ensure Ansible config is captured
ansible.builtin.command: ansible-config dump --only-changed
failed_when: false
changed_when: false
register: check_ansible_config
delegate_to: localhost
run_once: true
become: false
- name: Ensure a list of roles is captured
ansible.builtin.command: ansible-galaxy role list
failed_when: false
changed_when: false
register: check_ansible_roles
delegate_to: localhost
run_once: true
become: false
- name: Ensure facts are written to disk
ansible.builtin.copy:
dest: "{{ playbook_dir }}/pyratlabs-issue-dump.txt"
content: |
# Begin ANSIBLE VERSION
{{ check_ansible_version.stdout }}
# End ANSIBLE VERSION
# Begin ANSIBLE CONFIG
{{ check_ansible_config.stdout }}
# End ANSIBLE CONFIG
# Begin ANSIBLE ROLES
{{ check_ansible_roles.stdout }}
# End ANSIBLE ROLES
# Begin PLAY HOSTS
{{ ansible_play_hosts_all | to_json }}
# End PLAY HOSTS
# Begin K3S ROLE CONFIG
{% for host in ansible_play_hosts_all %}
## {{ host }}
{% for config_key in hostvars[host] %}
{% if config_key | regex_search('^k3s_') %}
{{ config_key }}: {{ hostvars[host][config_key] | to_json }}
{% endif %}
{% endfor %}
{% endfor %}
# End K3S ROLE CONFIG
# Begin K3S RUNTIME CONFIG
{% for host in ansible_play_hosts_all %}
## {{ host }}
{% if hostvars[host].k3s_runtime_config is defined %}
{{ hostvars[host].k3s_runtime_config }}
{% endif %}
{% endfor %}
# End K3S RUNTIME CONFIG
mode: 0600
delegate_to: localhost
run_once: true
become: false
- name: Fail the play
ansible.builtin.fail:
msg: "Please include the output of {{ playbook_dir }}/pyratlabs-issue-dump.txt in your bug report."
delegate_to: localhost
run_once: true