Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating load function to use cli_config #26

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ int his role inlcuding both configuration and fact collection.

## Requirements

* Ansible 2.6 or later
* Ansible Network Engine Role 2.6.0 or later
* Ansible 2.7 or later
* Ansible Network Engine Role 2.7.0 or later

## Functions

Expand Down
49 changes: 0 additions & 49 deletions includes/configure/configure.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions meta/config_manager/load.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
argument_spec:

ansible_network_os:
description:
- Set the name of the Ansible network OS platform. This value should be
set to `iosxr` for this provider.
required: true

config_manager_text:
description:
- Provide the network device configuration as a single string. The
configuration text will be loaded onto the target network deivce.
type: str
29 changes: 0 additions & 29 deletions meta/load_config_spec.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ galaxy_info:
license: GPLv3

min_ansible_version: 2.7
min_ansible_network_engine_version: 2.6.2
min_ansible_network_engine_version: 2.7.0

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
Expand Down
20 changes: 9 additions & 11 deletions tasks/config_manager/load.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
- name: initialize function
include_tasks: includes/init.yaml

- name: validate task arguments
validate_role_spec:
spec: load_config_spec.yaml
- name: validate config_manager_text is defined
fail:
msg: "missing required arg: config_manager_text"
when: config_manager_text is undefined

- name: lookup config file
set_fact:
iosxr_config_text: "{{ lookup('config_template', iosxr_config_file) | join('\n') }}"
when: iosxr_config_file != ''

- name: Include configure task
include_tasks: includes/configure/configure.yaml
when: not ansible_check_mode and not iosxr_config_replace
- name: load configuration into device
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justjais replace functionality is missing from this task? You may refer to https://github.com/ansible-network/vyos/blob/devel/tasks/config_manager/load.yaml#L21

cli_config:
config: "{{ iosxr_config_text }}"
vars:
iosxr_config_text: "{{ config_manager_text }}"