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

junipernetworks.junos.junos_config and delete statement does nothing #411

Open
aamsaleg opened this issue May 10, 2023 · 1 comment
Open
Assignees

Comments

@aamsaleg
Copy link

aamsaleg commented May 10, 2023

Hello

ansible-playbook version: 2.13.6
junipernetworks.junos galaxy collection version: 5.1.0

I have a simple playbook to add/delete static routes on a SRX.
add a new route works well
delete an existing route does nothing when using the playbook
delete manually the route works.

Run the following playbook twice.
First run : create the route
Second run: delete the route

The debug statement show the command line that should be done on the firewall.

Here my playbook:
`---

  • hosts: localhost

    gather_facts: no

    connection: local

    vars_prompt:

    • name: subnet
      prompt: Subnet a router
      private: no

    • name: next_hop
      prompt: next-hop
      private: no

    • name: action
      prompt: set ou delete
      private: no
      default: set

    tasks:

    • name: Storing informations.
      set_fact:
      subnet: "{{subnet }}"
      next_hop: "{{next_hop }}"
      action: "{{action}}"
  • hosts:

    • test-srx

    connection: netconf

    gather_facts: no

    vars:
    ansible_command_timeout: 300
    ansible_connect_timeout: 300

    tasks:

    • name: "{{ hostvars['localhost']['action'] }} route on test-srx"
      junipernetworks.junos.junos_config:
      lines: "{{ hostvars['localhost']['action'] }} logical-systems isv-fw-back routing-instances RI-BVxLAN routing-options static route {{ hostvars['localhost']['subnet'] }} next-hop {{ hostvars['localhost']['next_hop'] }}"

    • debug:
      msg:

      • "{{ hostvars['localhost']['action'] }} logical-systems isv-fw-back routing-instances RI-BVxLAN routing-options static route {{ hostvars['localhost']['subnet'] }} next-hop {{ hostvars['localhost']['next_hop'] }}"
        ...
        `

My guess is that delete statement is replace by a set statement.
There was on old issue about this behaviour: ansible/ansible#29775

Kind regards,

@aamsaleg
Copy link
Author

found a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants