Project

General

Profile

Actions

Bug #18906

closed

Add advanced jinja2 template example for main IP address

Added by Alexis Mousset almost 4 years ago. Updated over 3 years ago.

Status:
Released
Priority:
N/A
Category:
Documentation
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
Checked
Regression:

Description

Add an example of template logic to chose an IP by interface name priority.

{%- if   'bond0' in vars.sys.interfaces %}
    # 'bond0' in vars.sys.interfaces
    {%- set my_ip = vars.sys['ipv4[bond0]'] %}
{%- elif 'eth0' in vars.sys.interfaces %}
    # Found eth0 as default interface
    {%- set my_ip = vars.sys['ipv4[eth0]'] %}
{%- else %}
    # Not found bond0 or eth0, using default sys.ipv4
    {%- set my_ip = vars.sys.ipv4 %}
{%- endif %}
Actions #1

Updated by Alexis Mousset almost 4 years ago

  • Status changed from New to In progress
  • Assignee set to Alexis Mousset
Actions #2

Updated by Alexis Mousset almost 4 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Alexis Mousset to François ARMAND
  • Pull Request set to https://github.com/Normation/rudder-doc/pull/817
Actions #3

Updated by Alexis Mousset almost 4 years ago

  • Status changed from Pending technical review to Pending release
Actions #4

Updated by Alexis Mousset over 3 years ago

  • Fix check changed from To do to Checked
Actions #5

Updated by Vincent MEMBRÉ over 3 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 6.2.3 which was released today.

Actions

Also available in: Atom PDF