Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
moreati committed Jan 18, 2025
1 parent 9982198 commit f269965
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions tests/ansible/regression/issue_766__get_with_context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,50 @@
---
- name: regression/issue_766__get_with_context.yml
hosts: localhost
# Gather facts to use *and* to trigger any "could not recover task_vars" error
# https://github.com/mitogen-hq/mitogen/pull/1215#issuecomment-2596421111
gather_facts: true
vars:
netconf_container_image: ghcr.io/mitogen-hq/sysrepo-netopeer2:latest
netconf_container_name: sysprep
netconf_container_port: 8030
tasks:
- meta: end_play
when:
- ansible_facts.system == 'Darwin'

- block:
- name: Start container
delegate_to: localhost
vars:
ansible_port: 8040
containers.podman.podman_container:
name: sysprep
image: ghcr.io/mitogen-hq/sysrepo-netopeer2:latest
auto_remove: true
detach: true
recreate: true
published_ports:
- "{{ ansible_port }}:830"
command:
cmd: >-
podman run
--name "{{ netconf_container_name }}"
--detach
--rm
--publish "{{ netconf_container_port }}:830"
"{{ netconf_container_image }}"
changed_when: true

- name: Wait for container
delegate_to: localhost
# TODO robust condition. wait_for + search_regex? wait_for_connection?
wait_for:
timeout: 5

- name: Get running configuration and state data
vars:
ansible_port: 8040
ansible_port: "{{ netconf_container_port }}"
ansible_connection: netconf
ansible_user: netconf
ansible_password: netconf
ansible.netcommon.netconf_get:

always:
- name: Cleanup container
delegate_to: localhost
containers.podman.podman_container:
name: sysprep
state: absent
command:
cmd: "{{ item.cmd }}"
loop:
- cmd: podman stop "{{ netconf_container_name }}"
- cmd: podman rm "{{ netconf_container_name }}"
changed_when: true
tags:
- issue_766

0 comments on commit f269965

Please sign in to comment.