Skip to content

Commit

Permalink
Empty commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
aybarsm committed Jun 27, 2024
1 parent c6dbe5e commit ad35a0b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
19 changes: 0 additions & 19 deletions roles/grub/handlers/command.yml

This file was deleted.

23 changes: 18 additions & 5 deletions roles/grub/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
---
- name: Apply linux_grub changes
ansible.builtin.import_tasks:
file: command.yml
listen: "linux_grub_apply_changes"
when: (linux_grub_change_strategy | default('') == 'command')
- name: Apply command(s) for linux_grub changes
become: true
ansible.builtin.command:
chdir: "{{ item.chdir | default(omit) }}"
cmd: "{{ item.cmd }}"
creates: "{{ item.creates | default(omit) }}"
removes: "{{ item.removes | default(omit) }}"
stdin: "{{ item.stdin | default(omit) }}"
stdin_add_newline: "{{ item.stdin_add_newline | default(omit) }}"
strip_empty_ends: "{{ item.strip_empty_ends | default(omit) }}"
changed_when: true
loop: "{{ linux_grub_change | selectattr('cmd', 'defined') }}"
register: linux_grub_apply_changes_command
listen: "linux_grub_apply_changes_by_command"
when:
- linux_grub_change_strategy | default('') == 'command'
- linux_grub_change | type_debug == 'list'
- linux_grub_change | selectattr('cmd', 'defined') | length > 0
2 changes: 1 addition & 1 deletion roles/grub/tasks/grub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
- linux_grub_all | type_debug == 'list'
- linux_grub_all | length > 0
register: linux_grub_deploy
notify: linux_grub_apply_changes
notify: linux_grub_apply_changes_by_command
4 changes: 2 additions & 2 deletions roles/grub/templates/grub.cfg.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# {{ ansible_managed }}

{% for param in linux_grub_config_all %}
{% for param in linux_grub_all %}
{% if (param | type_debug) == 'dict' and 'name' in param %}
{% set paramName = (linux_grub_config_name_prefix | upper) ~ (param.name | upper) %}
{% set paramName = (linux_grub_entry_prefix | upper) ~ (param.name | upper) %}
{% if 'value' in param %}
{% if (param.value | type_debug) == 'list' %}
{% set inheritCmdlineDefault = param.name | lower == 'cmdline_linux_default' and linux_grub_inherit_cmdline_default | bool %}
Expand Down
10 changes: 8 additions & 2 deletions roles/network_interfaces/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ linux_network_interfaces_dir: /etc/network
linux_network_interfaces_file: interfaces
linux_network_interfaces_file_destination: "{{ linux_network_interfaces_dir + '/' + linux_network_interfaces_file }}"

# Seggrate network interfaces into separate files i.e. /etc/network/interfaces.d/eth0
# This has not been implemented yet
# TODO: Implement this feature
linux_network_interfaces_segregate: false
linux_network_interfaces_seggregate_dir: "{{ linux_network_interfaces_dir }}/interfaces.d"

# Keep the lo interface in the file
linux_network_interfaces_file_keep_lo: true
linux_network_interfaces_keep_lo: true
# The location of the source line in the file (controversial topic)
linux_network_interfaces_file_source_position: bottom
linux_network_interfaces_source_position: bottom
linux_network_interfaces_source_line: "source {{ linux_network_interfaces_seggregate_dir }}/*"

linux_network_interfaces_backup: true
Expand Down
4 changes: 2 additions & 2 deletions roles/network_interfaces/tasks/network_interfaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
backup: "{{ linux_network_interfaces_backup | default(omit) | bool }}"
mode: "0644"
when:
- linux_network_interfaces_ifaces_all | type_debug == 'list'
- linux_network_interfaces_ifaces_all | length > 0
- linux_network_interfaces_all | type_debug == 'list'
- linux_network_interfaces_all | length > 0
register: linux_network_interfaces_deploy_file
notify:
- linux_network_interfaces_apply_changes_by_command
Expand Down
8 changes: 4 additions & 4 deletions roles/network_interfaces/templates/network_interfaces.j2
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# {{ ansible_managed }}

{% if linux_network_interfaces_file_source_position == 'top' %}
{% if linux_network_interfaces_source_position == 'top' %}
{{ linux_network_interfaces_source_line }}

{% endif %}
{% if linux_network_interfaces_file_keep_lo | bool %}
{% if linux_network_interfaces_keep_lo | bool %}
# The loopback network interface
auto lo
iface lo inet loopback
{% endif %}

{% for iface in linux_network_interfaces_ifaces_all %}
{% for iface in linux_network_interfaces_all %}
{% if 'mount' in iface and iface.mount != 'None' %}
{{ iface.mount }} {{ iface.name }}
{% endif %}
Expand Down Expand Up @@ -43,6 +43,6 @@ iface {{ iface.name }} {{ addr_family }} {{ ifaceMethod }}
{% endif %}
{% endfor %}
{% endfor %}
{% if linux_network_interfaces_file_source_position != 'top' %}
{% if linux_network_interfaces_source_position != 'top' %}
{{ linux_network_interfaces_source_line }}
{% endif %}

0 comments on commit ad35a0b

Please sign in to comment.