diff --git a/tasks/main.yml b/tasks/main.yml index 78881f7..336e387 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,20 +2,7 @@ # get service facts, used in defaults/main.yml --- - name: Ensure ansible_facts used by role - setup: - gather_subset: min - when: not ansible_facts.keys() | list | - intersect(__network_required_facts) == __network_required_facts - no_log: true - -- name: Check which services are running - service_facts: - no_log: true - -# needed for ansible_facts.packages -- name: Check which packages are installed - package_facts: - no_log: true + include_tasks: tasks/set_facts.yml - name: Print network provider debug: diff --git a/tasks/set_facts.yml b/tasks/set_facts.yml new file mode 100644 index 0000000..c0c9ff6 --- /dev/null +++ b/tasks/set_facts.yml @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: BSD-3-Clause +--- +- name: Ensure ansible_facts used by role are present + setup: + gather_subset: min + when: not ansible_facts.keys() | list | + intersect(__network_required_facts) == __network_required_facts + no_log: true + +- name: Check which services are running + service_facts: + no_log: true + +# needed for ansible_facts.packages +- name: Check which packages are installed + package_facts: + no_log: true diff --git a/tests/setup-snapshot.yml b/tests/setup-snapshot.yml new file mode 100644 index 0000000..8302f62 --- /dev/null +++ b/tests/setup-snapshot.yml @@ -0,0 +1,12 @@ +- hosts: all + tasks: + - name: Set facts used by role + include_role: + name: linux-system-roles.network + tasks_from: set_facts.yml + public: true + + - name: Install test packages + package: + name: "{{ network_packages }}" + state: present