Skip to content

Commit

Permalink
Release 1.7.2-post1: use common task list in 'netlab config'
Browse files Browse the repository at this point in the history
'netlab config' command breaks when used with newer Ansible releases. The modified
deployment playbook uses the common 'tasks/deploy-custom-config.yml' task list used
by 'netlab initial'.
  • Loading branch information
ipspace committed Feb 4, 2024
1 parent ba2278e commit d6228f6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 60 deletions.
4 changes: 4 additions & 0 deletions docs/release/1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ For more details, read the [](../dev/validation.md)
## Bug Fixes

(bug-fixes-1.7.2)=
### Bug Fixes in Release 1.7.2-post1

* **netlab config** command breaks when used with newer Ansible releases. The modified deployment playbook uses the common _deploy custom configuration templates_ task list used by **netlab initial**.

### Bug Fixes in Release 1.7.2

* Change pinned Vagrant/vagrant-libvirt releases to Vagrant 2.4.0-1 and vagrant-libvirt 0.12.2. Both releases were successfully tested on Ubuntu 20.04 and 22.04
Expand Down
2 changes: 1 addition & 1 deletion legacy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

sys.path.append('..')

version="1.7.2"
version="1.7.2-post1"

long_description = (Path(__file__).parent / "README.md").read_text()

Expand Down
2 changes: 1 addition & 1 deletion netsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys

__version__ = "1.7.2"
__version__ = "1.7.2-post1"

try:
import box
Expand Down
67 changes: 9 additions & 58 deletions netsim/ansible/config.ansible
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,15 @@
gather_facts: false
vars:
node_provider: "{{ provider|default(netlab_provider) }}"
strategy: "{{ netlab_strategy|default('linear') }}"
tasks:
- block:
- set_fact:
netlab_device_type: "{{ netlab_device_type|default(ansible_network_os) }}"

- fail: msg="Specify configuration template name with an external variable"
when: config is not defined
run_once: true

- set_fact:
config_template: "{{ lookup('first_found',params,errors='ignore') }}"
vars:
params:
paths:
- "{{ lookup('env','PWD') }}"
- "."
files:
- "{{ config + '/' + inventory_hostname + '.' + netlab_device_type + '-' + node_provider + '.j2' }}"
- "{{ config + '/' + inventory_hostname + '.' + netlab_device_type + '.j2' }}"
- "{{ config + '/' + inventory_hostname + '.j2' }}"
- "{{ config + '/' + netlab_device_type + '-' + node_provider + '.j2' }}"
- "{{ config + '/' + netlab_device_type + '.j2' }}"
- "{{ config + '/' + ansible_network_os + '-' + node_provider + '.j2' }}"
- "{{ config + '/' + ansible_network_os + '.j2' }}"
- "{{ config + '.' + inventory_hostname + '.' + netlab_device_type + '.j2' }}"
- "{{ config + '.' + inventory_hostname + '.' + ansible_network_os + '.j2' }}"
- "{{ config + '.' + inventory_hostname + '.j2' }}"
- "{{ config + '.' + netlab_device_type + '.j2' }}"
- "{{ config + '.' + ansible_network_os + '.j2' }}"
- "{{ config }}"
- "{{ config + '.j2' }}"

- fail: msg="Cannot find configuration template {{ config }}"
when: config_template == ''
run_once: true

- debug:
msg: |
Config for {{ inventory_hostname }}
===================================
{{ lookup('template',config_template) }}
verbosity: 1

tags: [ always ]

- include_tasks: "{{ item }}"
with_first_found:
- "{{ lookup('env','PWD') }}/{{ custom_config }}/deploy-{{ inventory_hostname }}.yml"
- "{{ lookup('env','PWD') }}/{{ custom_config }}/deploy.{{ netlab_device_type }}-{{ node_provider }}.yml"
- "{{ lookup('env','PWD') }}/{{ custom_config }}/deploy.{{ netlab_device_type }}.yml"
- "{{ lookup('env','PWD') }}/{{ custom_config }}/deploy.{{ ansible_network_os }}-{{ node_provider }}.yml"
- "{{ lookup('env','PWD') }}/{{ custom_config }}/deploy.{{ ansible_network_os }}.yml"
- "{{ lookup('env','PWD') }}/{{ custom_config }}/deploy.yml"
- "tasks/deploy-config/{{netlab_device_type}}-{{node_provider}}.yml"
- "tasks/deploy-config/{{netlab_device_type}}.yml"
- "tasks/deploy-config/{{ansible_network_os}}.yml"
- fail: msg="Specify configuration template name with an external variable"
when: config is not defined
run_once: true
- set_fact:
netlab_device_type: "{{ netlab_device_type|default(ansible_network_os) }}"
custom_config: "{{ config }}"
- include_tasks: "tasks/deploy-custom-config.yml"
args:
apply:
vars:
netsim_action: "{{ config }}"
config_template: "{{ config_template }}"
tags: [ always ]

0 comments on commit d6228f6

Please sign in to comment.