mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
Fingerprint RHEL System Role managed config files
- Add role name to the generated config files. # system_role:network Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
This commit is contained in:
parent
2b693d14c0
commit
77214cbda4
3 changed files with 22 additions and 0 deletions
|
|
@ -1 +1,2 @@
|
|||
{{ ansible_managed | comment }}
|
||||
{{ "system_role:network" | comment(prefix="", postfix="") }}
|
||||
|
|
|
|||
|
|
@ -10,3 +10,8 @@
|
|||
assert:
|
||||
that: lsr_net_profile_ansible_managed
|
||||
msg: "profile {{ profile }} does not have the ansible managed comment"
|
||||
|
||||
- name: Assert that the fingerprint comment is present in {{ profile }}
|
||||
assert:
|
||||
that: lsr_net_profile_fingerprint
|
||||
msg: "profile {{ profile }} does not have the fingerprint comment"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
set_fact:
|
||||
lsr_net_profile_exists: false
|
||||
lsr_net_profile_ansible_managed: false
|
||||
lsr_net_profile_fingerprint: false
|
||||
|
||||
- name: Stat profile file
|
||||
stat:
|
||||
|
|
@ -28,6 +29,7 @@
|
|||
changed_when: false
|
||||
|
||||
# lsr_net_profile_ansible_managed:
|
||||
# lsr_net_profile_fingerprint:
|
||||
# under NetworkManager's control, the comment is not added by design.
|
||||
# Thus, set it always to true.
|
||||
- name: >-
|
||||
|
|
@ -36,6 +38,7 @@
|
|||
set_fact:
|
||||
lsr_net_profile_exists: true
|
||||
lsr_net_profile_ansible_managed: true
|
||||
lsr_net_profile_fingerprint: true
|
||||
when: nm_profile_exists.rc == 0
|
||||
|
||||
- name: Check ansible_managed comment for the initscripts case
|
||||
|
|
@ -55,3 +58,16 @@
|
|||
lsr_net_profile_ansible_managed: true
|
||||
when:
|
||||
- _result.stdout_lines | length == 1
|
||||
|
||||
- name: Get the fingerprint comment in ifcfg-{{ profile }}
|
||||
command: >-
|
||||
grep "^# system_role:network"
|
||||
/etc/sysconfig/network-scripts/ifcfg-{{ profile }}
|
||||
register: _result
|
||||
changed_when: false
|
||||
|
||||
- name: Verify the fingerprint comment in ifcfg-{{ profile }}
|
||||
set_fact:
|
||||
lsr_net_profile_fingerprint: true
|
||||
when:
|
||||
- _result.stdout_lines | length == 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue