Skip to content

Commit

Permalink
Merge pull request #421 from rebtoor/network_config_production_profile
Browse files Browse the repository at this point in the history
Make `edpm_network_config` role compliant with ansible-lint `production` profile
  • Loading branch information
openshift-ci[bot] authored Oct 10, 2023
2 parents 6d2e781 + 49b3d35 commit 010f5af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
8 changes: 3 additions & 5 deletions roles/edpm_network_config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
ansible.builtin.set_fact:
systemrolename:
"{%- if ansible_facts['distribution'] == 'RedHat' -%}
redhat.rhel
{%- else -%}
fedora.linux
{%- endif -%}
redhat.rhel{%- else -%}
fedora.linux{%- endif -%}
_system_roles.network"
delegate_to: localhost
- name: Install OVS NetworkManager plugin [nmstate]
Expand All @@ -39,7 +37,7 @@
ansible.builtin.systemd:
name: NetworkManager
state: restarted
when: nm_ovs_status.changed
when: nm_ovs_status.changed # noqa: no-handler
- name: Load system-roles.network tasks [nmstate]
ansible.builtin.include_role:
name: "{{ systemrolename }}"
Expand Down
16 changes: 8 additions & 8 deletions roles/edpm_network_config/tasks/network_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
become: true
when:
- ansible_facts.selinux.status == "enabled"
sefcontext:
community.general.sefcontext:
target: "/var/lib/edpm-config(/.*)?"
setype: container_file_t
selevel: s0
Expand Down Expand Up @@ -55,7 +55,7 @@
state: directory
setype: container_file_t
selevel: s0
mode: '0750'
mode: "0750"

- name: Check for previous run of NetworkConfig
become: true
Expand Down Expand Up @@ -97,21 +97,21 @@
ansible.builtin.file:
path: /etc/os-net-config
state: directory
mode: '0755'
mode: "0755"

- name: Create os-net-config mappings from lookup data
edpm_os_net_config_mappings:
net_config_data_lookup:
"{{ edpm_network_config_os_net_config_mappings }}"
when: not ansible_check_mode|bool
when: not ansible_check_mode | bool
register: os_net_config_mappings_result

- name: Write os-net-config mappings file /etc/os-net-config/mapping.yaml
ansible.builtin.copy:
content: "{{ os_net_config_mappings_result.mapping | to_nice_yaml }}"
dest: /etc/os-net-config/mapping.yaml
mode: '0644'
when: os_net_config_mappings_result.changed|bool
mode: "0644"
when: os_net_config_mappings_result.changed | bool # noqa: no-handler

- name: Manage NetworkConfig with edpm_os_net_config module
block:
Expand All @@ -127,7 +127,7 @@
ansible.builtin.copy:
content: "{{ network_config_result.rc }}"
dest: /var/lib/edpm-config/os-net-config.returncode
mode: '0644'
mode: "0644"
when:
- network_config_result.rc is defined

Expand All @@ -138,7 +138,7 @@
network:
config: disabled
dest: /etc/cloud/cloud.cfg.d/99-edpm-disable-network-config.cfg
mode: '0644'
mode: "0644"
when:
- network_config_result.rc is defined
- network_config_result.rc == 0
Expand Down

0 comments on commit 010f5af

Please sign in to comment.