- I have a router/host: mgmt_ip_addr = 1.1.1.1
- I use ansible to connect to this router/host
- My task is to apply a new configuration to this router.
- This new config will modify the mgmt_ip_addr of the host to 2.2.2.2
You see the problem here? I used 1.1.1.1 to connect to this host. Now I’m planning on modifying this ip to 2.2.2.2
As soon as the new config gets applied, my ansible ssh session breaks. Makes sense, my new config modified the mgmt ip.
However, I have a bgp task that should run after the new config has been applied. Obviously this bgp task never gets run because the session is already broken.
Is there a workaround for this? I want to be able to change and mgmt ip and continue working on other tasks after that during the same playbook run.
`
---## RENDER CONFIG, AND DO CONFIG OVERRIDE - name: "Rendering Junos jinja template into conf"
template:
src: "template_full_config.j2"
dest: "/Users/mfatty/Projects/ansible/nql_ansible/roles/junos_dut_role/rendered_full_config.conf"
tags: config_override - name: "load override with new config"
juniper_junos_config:
provider: "{{ credentials }}"
config_mode: "private"
load: "override"
src: "/Users/mfatty/Projects/ansible/nql_ansible/roles/junos_dut_role/rendered_full_config.conf"
format: "text"
register: response
tags: config_override - debug: msg = {{ response }}
tags: config_override## VERIFY BGP STATE
- name: check bgp status
juniper_junos_command:
provider: "{{ credentials }}"
commands: "show bgp summary"
tags: verify_bgp
register: response - debug:
var: response.stdout_lines
tags: verify_bgp
`
Thanks
Mo.