Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Arch Linux family support #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- name: Update grub
ansible.builtin.command:
cmd: "{{ grub_update_grub_command }}"
changed_when: yes
changed_when: true
when:
- ansible_connection not in [ "container", "docker", "community.docker.docker" ]
notify:
Expand Down
4 changes: 3 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ galaxy_info:
- name: Ubuntu
versions:
- all

- name: ArchLinux
versions:
- all
galaxy_tags:
- grub
- system
Expand Down
8 changes: 4 additions & 4 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
- grub_timeout is defined
- grub_timeout is number
- grub_timeout >= 0
quiet: yes
quiet: true

- name: assert | Test if grub_recordfail_timeout is set correctly
ansible.builtin.assert:
that:
- grub_recordfail_timeout is defined
- grub_recordfail_timeout is number
- grub_recordfail_timeout >= 0
quiet: yes
quiet: true

- name: assert | Test if grub_options is set correctly
ansible.builtin.assert:
that:
- grub_options is iterable
quiet: yes
quiet: true
when:
- grub_options is defined

Expand All @@ -31,7 +31,7 @@
- item.option is string
- item.option is not none
- item.value is defined
quiet: yes
quiet: true
loop: "{{ grub_options }}"
loop_control:
label: "{{ item.option }}"
Expand Down
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- name: Import assert.yml
ansible.builtin.import_tasks: assert.yml
run_once: yes
run_once: true
delegate_to: localhost

- name: Install required packages
Expand All @@ -15,7 +15,7 @@
ansible.builtin.lineinfile:
path: /etc/default/grub
line: GRUB_TIMEOUT={{ grub_timeout }}
create: yes
create: true
mode: "0664"
notify:
- Update grub
Expand All @@ -24,7 +24,7 @@
ansible.builtin.lineinfile:
path: /etc/default/grub
line: GRUB_RECORDFAIL_TIMEOUT={{ grub_recordfail_timeout }}
create: yes
create: true
mode: "0664"
notify:
- Update grub
Expand Down
4 changes: 4 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ _grub_packages:
- grub
Debian:
- grub2
Archlinux:
- grub


grub_packages: "{{ _grub_packages[ansible_os_family] | default(_grub_packages['default']) }}"

_grub_update_grub_command:
default: grub2-mkconfig -o /boot/grub2/grub.cfg
Alpine: grub-mkconfig -o /boot/grub/grub.cfg
Debian: update-grub
Archlinux: grub-mkconfig -o /boot/grub/grub.cfg

grub_update_grub_command: "{{ _grub_update_grub_command[ansible_os_family] | default(_grub_update_grub_command['default']) }}"