forked from saratov/infra
configure pbr after alterator`s commit
This commit is contained in:
parent
c7c3317689
commit
02982f4b66
@ -28,28 +28,3 @@
|
||||
notify: restart network
|
||||
with_items: "{{nic.value.ipv4}}"
|
||||
when: nic.value.ipv4 is defined
|
||||
|
||||
- name: "enable PBR for {{nic.key}}"
|
||||
block:
|
||||
- name: Generate sequance
|
||||
set_fact:
|
||||
tbl_id: nic.key | regex_replace('^eth(d+)', '\\1'
|
||||
|
||||
- name: add table
|
||||
lineinfile:
|
||||
path: /etc/iproute2/rt_tables
|
||||
line: "{{ (tbl_id | int) + 200 }} tbl_{{nic.key}}"
|
||||
notify: restart network
|
||||
- name: "create config for {{nic.key}}"
|
||||
file:
|
||||
path: "/etc/net/ifaces/{{nic.key}}"
|
||||
state: directory
|
||||
- name: define routing rules
|
||||
template:
|
||||
src: pbr_config.j2
|
||||
dest: "/etc/net/ifaces/{{nic.key}}/ifup-post"
|
||||
mode: '0755'
|
||||
with_items: "{{nic.value.ipv4}}"
|
||||
notify: restart network
|
||||
when: nic.value.ipv4 is defined and nic.value.default is defined
|
||||
when: node.net | length > 1 and nic.value.descr == 'priv'
|
||||
|
25
roles/common/tasks/configure_pbr.yml
Normal file
25
roles/common/tasks/configure_pbr.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: "enable PBR for {{nic.key}}"
|
||||
block:
|
||||
- name: Generate sequance
|
||||
set_fact:
|
||||
tbl_id: nic.key | regex_replace('^eth(d+)', '\\1'
|
||||
|
||||
- name: add table
|
||||
lineinfile:
|
||||
path: /etc/iproute2/rt_tables
|
||||
line: "{{ (tbl_id | int) + 200 }} tbl_{{nic.key}}"
|
||||
notify: restart network
|
||||
- name: "create config for {{nic.key}}"
|
||||
file:
|
||||
path: "/etc/net/ifaces/{{nic.key}}"
|
||||
state: directory
|
||||
- name: define routing rules
|
||||
template:
|
||||
src: pbr_config.j2
|
||||
dest: "/etc/net/ifaces/{{nic.key}}/ifup-post"
|
||||
mode: '0755'
|
||||
with_items: "{{nic.value.ipv4}}"
|
||||
notify: restart network
|
||||
when: nic.value.ipv4 is defined and nic.value.default is defined
|
||||
when: node.net | length > 1 and nic.value.descr == 'priv'
|
@ -104,6 +104,12 @@
|
||||
async: 100
|
||||
poll: 0
|
||||
|
||||
- name: configure PBR
|
||||
include_tasks: configure_pbr.yml
|
||||
with_dict: "{{node.net}}"
|
||||
loop_control:
|
||||
loop_var: nic
|
||||
|
||||
- name: update .tmp/ssh_config after NICs reconfiguration
|
||||
include_role: name="inventory"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user