|
37 | 37 | file_type: "file" |
38 | 38 | excludes: |
39 | 39 | - "{{ netplan_configuration_file }}" |
40 | | - register: "netplan_config_files" |
| 40 | + register: "__netplan_config_files" |
41 | 41 |
|
42 | 42 | - name: "Remove netplan config files." |
43 | 43 | ansible.builtin.file: |
44 | 44 | path: "{{ item.path }}" |
45 | 45 | state: "absent" |
46 | | - with_items: "{{ netplan_config_files['files'] }}" |
| 46 | + with_items: "{{ __netplan_config_files['files'] }}" |
47 | 47 |
|
48 | 48 | - name: "Create a netplan config file from template." |
49 | 49 | ansible.builtin.template: |
|
61 | 61 | - name: "Check if file ifstate exists." |
62 | 62 | ansible.builtin.stat: |
63 | 63 | path: "{{ ifupdown_ifstate_file }}" |
64 | | - register: "file_ifstate" |
| 64 | + register: "__file_ifstate" |
65 | 65 |
|
66 | 66 | - name: "Check whether to reboot host if file ifstate exists." |
67 | | - when: "file_ifstate.stat.exists" |
| 67 | + when: "__file_ifstate.stat.exists" |
68 | 68 | block: |
69 | 69 | - name: "Read in ifstate file content." |
70 | 70 | ansible.builtin.slurp: |
71 | 71 | src: "{{ ifupdown_ifstate_file }}" |
72 | | - register: "slurped_file" |
| 72 | + register: "__slurped_file" |
73 | 73 |
|
74 | 74 | - name: "Compare ifstate file content to determine whether reboot is necessary." |
75 | 75 | ansible.builtin.set_fact: |
76 | | - reboot_to_switch_to_netplan: "{{ slurped_file.content != 'lo=lo\n' | b64encode }}" |
| 76 | + __reboot_to_switch_to_netplan: "{{ __slurped_file.content != ('lo=lo\n' | b64encode) }}" |
77 | 77 |
|
78 | 78 | - name: "Trigger reboot to switch to netplan." |
79 | 79 | ansible.builtin.debug: |
80 | 80 | msg: | |
81 | 81 | "Reboot is required to switch from ifupdown to netplan. |
82 | 82 | Triggering the reboot handler now." |
83 | | - changed_when: "reboot_to_switch_to_netplan | bool" |
| 83 | + changed_when: "__reboot_to_switch_to_netplan | bool" |
84 | 84 | when: |
85 | | - - "reboot_to_switch_to_netplan | bool" |
| 85 | + - "__reboot_to_switch_to_netplan | bool" |
86 | 86 | notify: "Reboot managed node" |
87 | 87 |
|
88 | 88 | ... |
0 commit comments