device_configuration 569 Bytes
Newer Older
Attila Farkas's avatar
Attila Farkas committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---
# Basic configuration of all defined devices

- name: Configuring all hosts
  hosts: {{ hosts|map(attribute='host_name')|unique|join(',') }}
  become: yes
  roles:
    - hosts

{% for host in hosts %}
- name: Configuring host {{ host.host_name }}
  hosts: {{ host.host_name }}
  become: yes
  tasks:
  - name: Change default gateway
Attila Farkas's avatar
Attila Farkas committed
16
    command: route add default gw {{ host.router_ip }} {{ host.interface }}
Attila Farkas's avatar
Attila Farkas committed
17
18
19
20
21
22
23
24

{% endfor %}
- name: Configuring all routers
  hosts: {{ routers|map(attribute='router_name')|unique|join(',') }}
  become: yes
  roles:
    - routers
...