network/tasks/main.yml
Thomas Haller 29c7008f61 network: use top-level variables instead of nested "network" variable
The role already supported a default variable ("network_provider") and
host variables ("network_provider_default", "network_service_name",
"network_packages").

Don't use nested variables under "network" like

  network:
    provider:
    ignore_error:
    connections:

instead promote them all to top-level variables like:

  network_provider:
  network_ignore_error:
  network_connections:

This seems more consistent (as we already have multiple top-level
variables), it seems to follow ansible style, and it makes it easier
to overload individual variables via conditional include files.
2017-05-09 13:58:31 +02:00

27 lines
813 B
YAML

- name: Set version specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "default.yml"
- name: Install packages
package:
name: "{{ network_packages | default([]) }}"
state: present
- name: Enable network service
service:
name: "{{ network_service_name }}"
state: started
enabled: yes
- name: Configure networking connection profiles
network_connections:
provider: "{{ network_provider | mandatory }}"
ignore_errors: "{{ network_ignore_errors | default(omit) }}"
connections: "{{ network_connections | default([]) }}"
- name: Re-test connectivity
ping: