configure pbr after alterator`s commit

This commit is contained in:
Sergey Bubnov 2019-06-04 20:39:17 +04:00
parent c7c3317689
commit 02982f4b66
3 changed files with 31 additions and 25 deletions

View File

@ -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'

View 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'

View File

@ -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"