SUMMARY
on initial gather_subset: all variables are populated as expected.
However after a config change is made and gather_subset is ran again to update the variables the old values persist.
STEPS TO REPRODUCE
Run the below playbook against a vyos device.
---
- name: Network Getting Started First Playbook Extended
connection: ansible.netcommon.network_cli
gather_facts: false
hosts: all
tasks:
- name: Get config for VyOS devices
vyos.vyos.vyos_facts:
gather_subset: all
- name: Display the config
ansible.builtin.debug:
msg: "The hostname is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}"
- name: Update the hostname
vyos.vyos.vyos_hostname:
config:
hostname: vyos-updated
- name: Get changed config for VyOS devices
vyos.vyos.vyos_facts:
gather_subset: config
- name: Display the changed config
ansible.builtin.debug:
msg: "The new hostname is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}"EXPECTED RESULTS
Play name "Display the changed config" Should show the updated hostname from "Update the hostname"
ACTUAL RESULTS
PLAY [Network Getting Started First Playbook Extended] ********************************************************************************************************************
TASK [Get config for VyOS devices] ****************************************************************************************************************************************
ok: [10.25.3.51]
TASK [Display the config] *************************************************************************************************************************************************
ok: [10.25.3.51] => {
"msg": "The hostname is vyos and the OS is VyOS 1.3.2"
}
TASK [Update the hostname] ************************************************************************************************************************************************
changed: [10.25.3.51]
TASK [Get changed config for VyOS devices] ********************************************************************************************************************************
ok: [10.25.3.51]
TASK [Display the changed config] *****************************************************************************************************************************************
ok: [10.25.3.51] => {
"msg": "The new hostname is vyos and the OS is VyOS 1.3.2"
}
PLAY RECAP ****************************************************************************************************************************************************************
10.25.3.51 : ok=5 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0