|
1 | 1 | ---
|
2 |
| -# Copyright 2018 IBM Corp. |
| 2 | +# Copyright 2019 IBM Corp. |
3 | 3 | #
|
4 | 4 | # All Rights Reserved.
|
5 | 5 | #
|
|
65 | 65 | {{ scripts_path }}/python/inv_set_interface_names.py \
|
66 | 66 | {{ item.key }} {{ item.value }} {{ config_path }}"
|
67 | 67 | with_dict: "{{ set_macs_all }}"
|
| 68 | + |
| 69 | +- name: Disable any ifcfg scripts that will become stale after renames |
| 70 | + hosts: client_nodes |
| 71 | + gather_facts: True |
| 72 | + vars: |
| 73 | + stale_devs: [] |
| 74 | + tasks: |
| 75 | + - block: |
| 76 | + - name: Create list of PXE devices that will be renamed |
| 77 | + set_fact: |
| 78 | + stale_devs: "{{ stale_devs + [mac_to_device[item.0|lower]] }}" |
| 79 | + with_together: |
| 80 | + - "{{ vars['pxe']['macs'] }}" |
| 81 | + - "{{ vars['pxe']['rename'] }}" |
| 82 | + - "{{ vars['pxe']['devices'] }}" |
| 83 | + when: |
| 84 | + - item.0 is not none |
| 85 | + - item.1 |
| 86 | + - item.2 != mac_to_device[item.0|lower] |
| 87 | + |
| 88 | + - name: Create list of Data devices that will be renamed |
| 89 | + set_fact: |
| 90 | + stale_devs: "{{ stale_devs + [mac_to_device[item.0|lower]] }}" |
| 91 | + with_together: |
| 92 | + - "{{ vars['data']['macs'] }}" |
| 93 | + - "{{ vars['data']['rename'] }}" |
| 94 | + - "{{ vars['data']['devices'] }}" |
| 95 | + when: |
| 96 | + - item.0 is not none |
| 97 | + - item.1 |
| 98 | + - item.2 != mac_to_device[item.0|lower] |
| 99 | + |
| 100 | + - name: Find all interface configuration scripts |
| 101 | + find: |
| 102 | + paths: /etc/sysconfig/network-scripts/ |
| 103 | + patterns: 'ifcfg-*' |
| 104 | + register: ifcfg_scripts |
| 105 | + |
| 106 | + - name: Disable any interface scripts that will become stale |
| 107 | + lineinfile: |
| 108 | + path: "{{ item.path }}" |
| 109 | + regexp: '^ONBOOT=' |
| 110 | + line: 'ONBOOT=no # Disabled by POWER-Up' |
| 111 | + when: |
| 112 | + - (item.path | basename).split('-')[1] != 'lo' |
| 113 | + - (item.path | basename).split('-')[1] in stale_devs |
| 114 | + loop: "{{ ifcfg_scripts.files }}" |
| 115 | + when: (ansible_distribution == 'CentOS' or |
| 116 | + ansible_distribution == 'RedHat') |
68 | 117 | ...
|
0 commit comments