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

Support for custom ca paths #24

Merged
merged 2 commits into from
Dec 14, 2023
Merged
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 galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace: nokia
name: srlinux

# The version of the collection. Must be compatible with semantic versioning
version: 0.3.0
version: 0.4.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down Expand Up @@ -46,7 +46,7 @@ tags:
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies:
"ansible.netcommon": ">=5.1.0"
"ansible.netcommon": ">=5.2.0"

# The URL of the originating SCM repository
repository: https://github.com/nokia/srlinux-ansible-collection
Expand Down
9 changes: 8 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ function test-tls-skip {
ansible-playbook playbooks/tls-skipped-check.yml "$@"
}

function test-tls-custom-ca {
_cdTests
revert-to-checkpoint
ansible-playbook playbooks/tls-with-custom-ca.yml "$@"
}

function test-get-container {
_cdTests
revert-to-checkpoint
Expand Down Expand Up @@ -276,6 +282,7 @@ function _run-tests {
test-cli-wrong-cmd "$@"
test-tls-fail "$@"
test-tls-skip "$@"
test-tls-custom-ca "$@"
test-set-check-mode "$@"
test-set-leaves "$@"
test-set-leaves-twice "$@"
Expand Down Expand Up @@ -306,7 +313,7 @@ function test {

# ci-test is a wrapper for testing in CI which first setups the environment.
function ci-test {
install-containerlab 0.41.2
install-containerlab 0.48.6
install-local-collection
deploy-lab

Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/tls-missed-check-fail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
vars:
ansible_httpapi_use_ssl: yes
tasks:
- name: json RPC get
- name: Get with TLS required but without setting skip verify or custom ca cert
nokia.srlinux.get:
paths:
- path: /system/information
Expand Down
21 changes: 21 additions & 0 deletions tests/playbooks/tls-with-custom-ca.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

- name: TLS with custom CA
hosts: clab
gather_facts: false
vars:
ansible_httpapi_use_ssl: yes
ansible_httpapi_ca_path: "{{ playbook_dir }}/../../scripts/clab-ansible/.tls/ca/ca.pem"
tasks:
- name: Get with TLS required and custom ca cert
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
register: get_return
failed_when: get_return.failed

- debug:
var: get_return