mirror of
https://github.com/nicolabs/ansible-role-grub.git
synced 2026-04-26 02:34:42 +02:00
Compare commits
82 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83d5263110 | ||
|
|
4ace85d0c9 | ||
|
|
52cadaa0ec | ||
|
|
04777093a3 | ||
|
|
5a7385c84d | ||
|
|
2e7a96e161 | ||
|
|
6e280c5f06 | ||
|
|
5469c0d3db | ||
|
|
9b24b14981 | ||
|
|
2f48d692ee | ||
|
|
f8e1dac3c0 | ||
|
|
cac9ee91b1 | ||
|
|
66dd1596bb | ||
|
|
b01c72ceaf | ||
|
|
29c7861c1e | ||
|
|
08d65d516e | ||
|
|
a7b8723042 | ||
|
|
cc6f27b9d1 | ||
|
|
53fdf2a0f3 | ||
|
|
8602ff13bb | ||
|
|
a95d592458 | ||
|
|
efa9fbbc58 | ||
|
|
8de8c7f2a6 | ||
|
|
5735981cec | ||
|
|
9c5b5ef5a2 | ||
|
|
d946c8b5c8 | ||
|
|
cdf238c5dc | ||
|
|
78c11572ce | ||
|
|
4b52911e4d | ||
|
|
6d7858759a | ||
|
|
7d1f961ddc | ||
|
|
4ffae7c7a8 | ||
|
|
b8a124d6b6 | ||
|
|
4b4cde9c72 | ||
|
|
4f3fe7f31f | ||
|
|
4c0bd748e1 | ||
|
|
f364074fbb | ||
|
|
26360a1461 | ||
|
|
c100344c71 | ||
|
|
9015586512 | ||
|
|
da222d7eaa | ||
|
|
a369d755fb | ||
|
|
9c8be0accd | ||
|
|
bc5d77a50b | ||
|
|
8244ddde1e | ||
|
|
159ecf185b | ||
|
|
e9a353d5c9 | ||
|
|
b1ee31df3f | ||
|
|
c31d1cf22a | ||
|
|
de6e5d5108 | ||
|
|
7736a844d4 | ||
|
|
577af9770b | ||
|
|
04da46a182 | ||
|
|
04df7e5cfd | ||
|
|
1954769b2c | ||
|
|
5b1fbdde73 | ||
|
|
bad6722e2d | ||
|
|
c3dfba9bfb | ||
|
|
8fe82e04cd | ||
|
|
fdba5737de | ||
|
|
7345e91c75 | ||
|
|
1d4fdbf903 | ||
|
|
7b5e648136 | ||
|
|
d03766cf22 | ||
|
|
a2efcd57a2 | ||
|
|
1b4556c805 | ||
|
|
a855f07290 | ||
|
|
b89432f0a8 | ||
|
|
12fcea5d88 | ||
|
|
96d4383702 | ||
|
|
e313e7fa52 | ||
|
|
f0db7c3211 | ||
|
|
e920beca01 | ||
|
|
e6634b803f | ||
|
|
717fad4dd6 | ||
|
|
649460a667 | ||
|
|
490240fd3a | ||
|
|
5af1acefdb | ||
|
|
e09608f1f9 | ||
|
|
ce718f73f6 | ||
|
|
182c25e96c | ||
|
|
9759194404 |
|
|
@ -1,7 +1,12 @@
|
|||
---
|
||||
#
|
||||
# Ansible managed
|
||||
#
|
||||
exclude_paths:
|
||||
- ./meta/preferences.yml
|
||||
- ./molecule/default/prepare.yml
|
||||
- ./molecule/default/converge.yml
|
||||
- ./molecule/default/verify.yml
|
||||
- ./molecule/default/collections.yml
|
||||
- ./.tox
|
||||
- ./.cache
|
||||
|
|
|
|||
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -5,6 +5,7 @@ about: Create a report to help me improve
|
|||
---
|
||||
|
||||
## Describe the bug
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
## Playbook
|
||||
|
|
|
|||
10
.github/workflows/galaxy.yml
vendored
10
.github/workflows/galaxy.yml
vendored
|
|
@ -6,15 +6,11 @@
|
|||
name: Release to Ansible Galaxy
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
schedule:
|
||||
- cron: '7 7 7 * *'
|
||||
|
||||
release:
|
||||
types: [created, edited, published, released]
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: galaxy
|
||||
uses: robertdebock/galaxy-action@1.1.0
|
||||
|
|
|
|||
20
.github/workflows/molecule.yml
vendored
20
.github/workflows/molecule.yml
vendored
|
|
@ -11,40 +11,38 @@ on:
|
|||
- '*'
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '7 7 7 * *'
|
||||
- cron: '13 7 7 * *'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: "${{ github.repository }}"
|
||||
- name: molecule
|
||||
uses: robertdebock/molecule-action@2.6.3
|
||||
uses: robertdebock/molecule-action@4.0.7
|
||||
with:
|
||||
command: lint
|
||||
test:
|
||||
needs:
|
||||
- lint
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- image: "alpine"
|
||||
tag: "latest"
|
||||
- image: "centos"
|
||||
tag: "7"
|
||||
- image: "centos"
|
||||
- image: "enterpriselinux"
|
||||
tag: "latest"
|
||||
- image: "debian"
|
||||
tag: "latest"
|
||||
- image: "debian"
|
||||
tag: "bullseye"
|
||||
tag: "bookworm"
|
||||
- image: "fedora"
|
||||
tag: "32"
|
||||
tag: "34"
|
||||
- image: "fedora"
|
||||
tag: "latest"
|
||||
- image: "fedora"
|
||||
|
|
@ -55,8 +53,6 @@ jobs:
|
|||
tag: "latest"
|
||||
- image: "ubuntu"
|
||||
tag: "bionic"
|
||||
- image: "ubuntu"
|
||||
tag: "xenial"
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
|
@ -67,7 +63,7 @@ jobs:
|
|||
- name: parse apparmor for mysql
|
||||
run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
|
||||
- name: molecule
|
||||
uses: robertdebock/molecule-action@2.6.3
|
||||
uses: robertdebock/molecule-action@4.0.7
|
||||
with:
|
||||
image: ${{ matrix.config.image }}
|
||||
tag: ${{ matrix.config.tag }}
|
||||
|
|
|
|||
34
.github/workflows/requirements2png.yml
vendored
Normal file
34
.github/workflows/requirements2png.yml
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
#
|
||||
# Ansible managed
|
||||
#
|
||||
|
||||
on:
|
||||
- push
|
||||
|
||||
name: Ansible Graphviz
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: ${{ github.repository }}
|
||||
- name: create png
|
||||
uses: robertdebock/graphviz-action@1.0.7
|
||||
- name: Commit files
|
||||
run: |
|
||||
cd ${{ github.repository }}
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add requirements.dot requirements.png
|
||||
git commit -m "Add generated files"
|
||||
- name: save to png branch
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
directory: ${{ github.repository }}
|
||||
force: true
|
||||
branch: png
|
||||
20
.github/workflows/todo.yml
vendored
Normal file
20
.github/workflows/todo.yml
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
#
|
||||
# Ansible managed
|
||||
#
|
||||
|
||||
name: "TODO 2 Issue"
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-20.04"
|
||||
steps:
|
||||
- uses: "actions/checkout@master"
|
||||
- name: "TODO to Issue"
|
||||
uses: "alstr/todo-to-issue-action@v2.3"
|
||||
id: "todo"
|
||||
with:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,3 +2,5 @@
|
|||
*.log
|
||||
*.swp
|
||||
.tox
|
||||
.cache
|
||||
.DS_Store
|
||||
|
|
|
|||
44
.gitlab-ci.yml
Normal file
44
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
image: "robertdebock/github-action-molecule:4.0.6"
|
||||
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
variables:
|
||||
DOCKER_HOST: "tcp://docker:2375"
|
||||
PY_COLORS: 1
|
||||
|
||||
molecule:
|
||||
script:
|
||||
- image=${image} tag=${tag} molecule test
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "master"
|
||||
retry: 1
|
||||
parallel:
|
||||
matrix:
|
||||
- image: "alpine"
|
||||
tag: "latest"
|
||||
- image: "enterpriselinux"
|
||||
tag: "latest"
|
||||
- image: "debian"
|
||||
tag: "latest"
|
||||
- image: "debian"
|
||||
tag: "bookworm"
|
||||
- image: "fedora"
|
||||
tag: "34"
|
||||
- image: "fedora"
|
||||
tag: "latest"
|
||||
- image: "fedora"
|
||||
tag: "rawhide"
|
||||
- image: "opensuse"
|
||||
tag: "latest"
|
||||
- image: "ubuntu"
|
||||
tag: "latest"
|
||||
- image: "ubuntu"
|
||||
tag: "bionic"
|
||||
|
||||
galaxy:
|
||||
script:
|
||||
- ansible-galaxy role import --api-key ${GALAXY_API_KEY} ${CI_PROJECT_NAMESPACE} ${CI_PROJECT_NAME}
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG != null
|
||||
|
|
@ -1,20 +1,24 @@
|
|||
---
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.2.0
|
||||
rev: v4.0.1
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-added-large-files
|
||||
|
||||
- repo: https://github.com/adrienverge/yamllint.git
|
||||
rev: v1.17.0
|
||||
- repo: https://github.com/adrienverge/yamllint
|
||||
rev: v1.26.3
|
||||
hooks:
|
||||
- id: yamllint
|
||||
args: [-c=.yamllint]
|
||||
|
||||
- repo: https://github.com/ansible/ansible-lint.git
|
||||
rev: v4.3.5
|
||||
- repo: https://github.com/robertdebock/pre-commit
|
||||
rev: v1.4.4
|
||||
hooks:
|
||||
- id: ansible-lint
|
||||
pass_filenames: false
|
||||
- id: ansible_role_find_unused_variable
|
||||
- id: ansible_role_find_empty_files
|
||||
- id: ansible_role_find_empty_directories
|
||||
- id: ansible_role_fix_readability
|
||||
- id: ansible_role_find_undefined_handlers
|
||||
- id: ansible_role_find_unquoted_values
|
||||
|
|
|
|||
28
.travis.yml
28
.travis.yml
|
|
@ -8,42 +8,22 @@ os: linux
|
|||
dist: xenial
|
||||
|
||||
python:
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
global:
|
||||
namespace="robertdebock"
|
||||
jobs:
|
||||
- image="alpine" tag="latest"
|
||||
- image="centos" tag="7"
|
||||
- image="centos" tag="latest"
|
||||
- image="debian" tag="latest"
|
||||
- image="debian" tag="bullseye"
|
||||
- image="fedora" tag="32"
|
||||
- image="fedora" tag="latest"
|
||||
- image="fedora" tag="rawhide"
|
||||
- image="opensuse" tag="latest"
|
||||
- image="ubuntu" tag="latest"
|
||||
- image="ubuntu" tag="bionic"
|
||||
- image="ubuntu" tag="xenial"
|
||||
|
||||
cache:
|
||||
- pip
|
||||
|
||||
install:
|
||||
- pip install --upgrade pip
|
||||
- pip install tox
|
||||
- pip install ansible ansible-lint yamllint
|
||||
|
||||
script:
|
||||
- function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox
|
||||
- yamllint .
|
||||
- ansible-lint
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
slack:
|
||||
secure: "E6M/5RjJ9e6q2ujf1DeOj0fBFClWSegDduStUOD/VTQolRcAld5+KYG0lt0amAt/fWahMd7XP+6p5OLjojGv8KuKcRIOneKxVWNfRaNN9+crStXqEUPUQ3NrNvjRPLearJGY4aCzWBpw4j29w4MVWQ3NNTMdUUupxIxo+X1+DBiFoB0KG4QJejxg61bG7ZRTwTJkOqlsfPD3Zy7WgFi9kE8iTjk8NYEeqJ2PkXw2moWcfxb1Ws1r8gwVJAS4boN4QE/CpCKJVBwgA7WWdwc/q+zTIY4mRif2w0huUyMRbL10eWhM4mUJpKFftp+Syg4oCRLSKfznkun8XrjnUA7WNSb51yCKgKhOUc/AQVtiDDqvWemz41jTJad2bFfgoe1faa+PM9SaD6S4e3SyyiQYkI6LAzMRTwobriCkM2wBUrpgQLQmGw4hT7ev8GpvMFeaRTfa0vstcXR2qPplfGPu3R/j5dKjevFo3rrxy3Ef9fojCnepRqgjHK7q0NC+sNlqI6zTNfCUKVMnwsCzAvCcyZP4jyxn3pLZnh2hTKKK461/9ZH5Nb6w3SNxZHH2ZVQmAoviKZ4xryGLc541PXw4xQYba87xJ7V/XL1Ch4E2NUjReK8CjzXUwQKj2WKgDz5EalvIp0U0ax69xFMOtu+zLeqE7Gu6fl2o6s/E1UrqO3g="
|
||||
on_success: change
|
||||
template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)"
|
||||
email: false
|
||||
|
|
|
|||
2
LICENSE
2
LICENSE
|
|
@ -187,7 +187,7 @@
|
|||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2020 Robert de Bock (robert@meinit.nl)
|
||||
Copyright 2022 Robert de Bock (robert@meinit.nl)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
69
README.md
69
README.md
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
Configure grub on your system.
|
||||
|
||||
|Travis|GitHub|Quality|Downloads|Version|
|
||||
|GitHub|GitLab|Quality|Downloads|Version|
|
||||
|------|------|-------|---------|-------|
|
||||
|[](https://travis-ci.com/robertdebock/ansible-role-grub)|[](https://github.com/robertdebock/ansible-role-grub/actions)|[](https://galaxy.ansible.com/robertdebock/grub)|[](https://galaxy.ansible.com/robertdebock/grub)|[](https://github.com/robertdebock/ansible-role-grub/releases/)|
|
||||
|[](https://github.com/robertdebock/ansible-role-grub/actions)|[](https://gitlab.com/robertdebock/ansible-role-grub)|[](https://galaxy.ansible.com/robertdebock/grub)|[](https://galaxy.ansible.com/robertdebock/grub)|[](https://github.com/robertdebock/ansible-role-grub/releases/)|
|
||||
|
||||
## [Example Playbook](#example-playbook)
|
||||
|
||||
This example is taken from `molecule/resources/converge.yml` and is tested on each push, pull request and release.
|
||||
This example is taken from `molecule/default/converge.yml` and is tested on each push, pull request and release.
|
||||
```yaml
|
||||
---
|
||||
- name: Converge
|
||||
|
|
@ -25,7 +25,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea
|
|||
value: 0
|
||||
```
|
||||
|
||||
The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`:
|
||||
The machine needs to be prepared. In CI this is done using `molecule/default/prepare.yml`:
|
||||
```yaml
|
||||
---
|
||||
- name: prepare
|
||||
|
|
@ -38,12 +38,13 @@ The machine needs to be prepared in CI this is done using `molecule/resources/pr
|
|||
|
||||
tasks:
|
||||
- name: make /etc/default
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /etc/default
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: place bogus /etc/default/grub
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: 'GRUB_CMDLINE_LINUX="a=1"'
|
||||
dest: /etc/default/grub
|
||||
mode: "0664"
|
||||
|
|
@ -53,7 +54,7 @@ Also see a [full explanation and example](https://robertdebock.nl/how-to-use-the
|
|||
|
||||
## [Role Variables](#role-variables)
|
||||
|
||||
These variables are set in `defaults/main.yml`:
|
||||
The default values for the variables are set in `defaults/main.yml`:
|
||||
```yaml
|
||||
---
|
||||
# defaults file for grub
|
||||
|
|
@ -70,21 +71,22 @@ grub_recordfail_timeout: "{{ grub_timeout }}"
|
|||
|
||||
## [Requirements](#requirements)
|
||||
|
||||
- Access to a repository containing packages, likely on the internet.
|
||||
- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.)
|
||||
- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-grub/blob/master/requirements.txt).
|
||||
|
||||
## [Status of requirements](#status-of-requirements)
|
||||
## [Status of used roles](#status-of-requirements)
|
||||
|
||||
| Requirement | Travis | GitHub |
|
||||
The following roles are used to prepare a system. You can prepare your system in another way.
|
||||
|
||||
| Requirement | GitHub | GitLab |
|
||||
|-------------|--------|--------|
|
||||
| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [](https://travis-ci.com/robertdebock/ansible-role-bootstrap) | [](https://github.com/robertdebock/ansible-role-bootstrap/actions) |
|
||||
|[robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap)|[](https://github.com/robertdebock/ansible-role-bootstrap/actions)|[](https://gitlab.com/robertdebock/ansible-role-bootstrap)|
|
||||
|
||||
## [Context](#context)
|
||||
|
||||
This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information.
|
||||
|
||||
Here is an overview of related roles:
|
||||

|
||||

|
||||
|
||||
## [Compatibility](#compatibility)
|
||||
|
||||
|
|
@ -93,13 +95,13 @@ This role has been tested on these [container images](https://hub.docker.com/u/r
|
|||
|container|tags|
|
||||
|---------|----|
|
||||
|alpine|all|
|
||||
|el|7, 8|
|
||||
|debian|buster, bullseye|
|
||||
|el|8|
|
||||
|debian|all|
|
||||
|fedora|all|
|
||||
|opensuse|all|
|
||||
|ubuntu|focal, bionic, xenial|
|
||||
|ubuntu|all|
|
||||
|
||||
The minimum version of Ansible required is 2.9, tests have been done to:
|
||||
The minimum version of Ansible required is 2.10, tests have been done to:
|
||||
|
||||
- The previous version.
|
||||
- The current version.
|
||||
|
|
@ -107,45 +109,12 @@ The minimum version of Ansible required is 2.9, tests have been done to:
|
|||
|
||||
|
||||
|
||||
## [Testing](#testing)
|
||||
|
||||
[Unit tests](https://travis-ci.com/robertdebock/ansible-role-grub) are done on every commit, pull request, release and periodically.
|
||||
|
||||
If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-grub/issues)
|
||||
|
||||
Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule):
|
||||
|
||||
[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions.
|
||||
[Molecule](https://github.com/ansible/molecule) tests multiple distributions.
|
||||
|
||||
To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`):
|
||||
|
||||
```
|
||||
molecule test
|
||||
|
||||
# Or select a specific image:
|
||||
image=ubuntu molecule test
|
||||
# Or select a specific image and a specific tag:
|
||||
image="debian" tag="stable" tox
|
||||
```
|
||||
|
||||
Or you can test multiple versions of Ansible, and select images:
|
||||
Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests:
|
||||
|
||||
```
|
||||
tox
|
||||
|
||||
# To run CentOS (namespace: `robertdebock`, tag: `latest`)
|
||||
image="centos" tox
|
||||
# Or customize more:
|
||||
image="debian" tag="stable" tox
|
||||
```
|
||||
|
||||
## [License](#license)
|
||||
|
||||
Apache-2.0
|
||||
|
||||
|
||||
## [Author Information](#author-information)
|
||||
|
||||
[Robert de Bock](https://robertdebock.nl/)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
# defaults file for grub
|
||||
|
||||
grub_timeout: 5
|
||||
#grub_timeout: 5
|
||||
|
||||
grub_recordfail_timeout: "{{ grub_timeout }}"
|
||||
#grub_recordfail_timeout: "{{ grub_timeout }}"
|
||||
|
||||
# Add options here, for example:
|
||||
# grub_options:
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
---
|
||||
# handlers file for grub
|
||||
|
||||
- name: update grub
|
||||
command: "{{ grub_update_grub_command }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "{{ grub_update_grub_command }}"
|
||||
when:
|
||||
- ansible_connection != "docker"
|
||||
- ansible_connection not in [ "container", "docker", "community.docker.docker" ]
|
||||
notify:
|
||||
- reboot
|
||||
|
||||
- name: reboot
|
||||
reboot:
|
||||
ansible.builtin.reboot:
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
---
|
||||
galaxy_info:
|
||||
author: Robert de Bock
|
||||
namespace: robertdebock
|
||||
role_name: grub
|
||||
description: Configure grub on your system.
|
||||
license: Apache-2.0
|
||||
company: none
|
||||
min_ansible_version: 2.9
|
||||
min_ansible_version: "2.10"
|
||||
|
||||
platforms:
|
||||
- name: Alpine
|
||||
|
|
@ -13,12 +14,10 @@ galaxy_info:
|
|||
- all
|
||||
- name: EL
|
||||
versions:
|
||||
- 7
|
||||
- 8
|
||||
- name: Debian
|
||||
versions:
|
||||
- buster
|
||||
- bullseye
|
||||
- all
|
||||
- name: Fedora
|
||||
versions:
|
||||
- all
|
||||
|
|
@ -27,9 +26,7 @@ galaxy_info:
|
|||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- focal
|
||||
- bionic
|
||||
- xenial
|
||||
- all
|
||||
|
||||
galaxy_tags:
|
||||
- grub
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ dependency:
|
|||
name: galaxy
|
||||
options:
|
||||
role-file: requirements.yml
|
||||
requirements-file: requirements.yml
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
|
|
@ -22,9 +23,5 @@ platforms:
|
|||
pre_build_image: yes
|
||||
provisioner:
|
||||
name: ansible
|
||||
config_options:
|
||||
defaults:
|
||||
stdout_callback: yaml
|
||||
bin_ansible_callbacks: yes
|
||||
verifier:
|
||||
name: ansible
|
||||
|
|
|
|||
|
|
@ -9,12 +9,13 @@
|
|||
|
||||
tasks:
|
||||
- name: make /etc/default
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /etc/default
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: place bogus /etc/default/grub
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: 'GRUB_CMDLINE_LINUX="a=1"'
|
||||
dest: /etc/default/grub
|
||||
mode: "0664"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
tasks:
|
||||
- name: check that bogus options are in
|
||||
command: grep 'a=1' /etc/default/grub
|
||||
ansible.builtin.command:
|
||||
cmd: grep 'a=1' /etc/default/grub
|
||||
|
||||
- name: check that selected option is in
|
||||
command: grep 'cgroup_enable=memory' /etc/default/grub
|
||||
ansible.builtin.command:
|
||||
cmd: grep 'cgroup_enable=memory' /etc/default/grub
|
||||
|
|
|
|||
10
requirements.txt
Normal file
10
requirements.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# These role have been tested with these PIP component.
|
||||
# To install the required version yourself, use a command as:
|
||||
# `python -m pip --user install -r requirements.txt`
|
||||
# See the pip requirements file documentation for details:
|
||||
# https://pip.pypa.io/en/stable/user_guide/#requirements-files
|
||||
#
|
||||
# Tests run on the previous and current (latest) version of Ansible.
|
||||
ansible>=2.10
|
||||
# Some Jinja2 filters are used that are available in the newer releases.
|
||||
jinja2>=2.11.2
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
roles:
|
||||
- name: robertdebock.bootstrap
|
||||
collections:
|
||||
|
|
|
|||
|
|
@ -1,33 +1,34 @@
|
|||
---
|
||||
|
||||
- name: test if grub_timeout is set correctly
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- grub_timeout is defined
|
||||
- grub_timeout | int >= 0
|
||||
- grub_timeout is number
|
||||
- grub_timeout >= 0
|
||||
quiet: yes
|
||||
when: grub_timeout is defined
|
||||
|
||||
- name: test if grub_recordfail_timeout is set correctly
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- grub_recordfail_timeout is defined
|
||||
- grub_recordfail_timeout | int >= 0
|
||||
- grub_recordfail_timeout is number
|
||||
- grub_recordfail_timeout >= 0
|
||||
quiet: yes
|
||||
when: grub_timeout is defined and grub_recordfail_timeout is defined
|
||||
|
||||
- name: test if grub_options is set correctly
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- grub_options | length > 0
|
||||
- grub_options is iterable
|
||||
quiet: yes
|
||||
when:
|
||||
- grub_options is defined
|
||||
|
||||
- name: test if item in grub_options is set correctly
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- item.option is defined
|
||||
- item.option | length > 0
|
||||
- item.value is defined
|
||||
- item.option is string
|
||||
quiet: yes
|
||||
loop: "{{ grub_options }}"
|
||||
loop_control:
|
||||
|
|
|
|||
|
|
@ -1,37 +1,41 @@
|
|||
---
|
||||
# tasks file for grub
|
||||
- name: include assert.yml
|
||||
include_tasks: assert.yml
|
||||
|
||||
- name: import assert.yml
|
||||
ansible.builtin.import_tasks: assert.yml
|
||||
run_once: yes
|
||||
delegate_to: localhost
|
||||
|
||||
- name: install required packages
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ grub_packages }}"
|
||||
state: present
|
||||
|
||||
- name: set GRUB_TIMEOUT
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/default/grub
|
||||
line: GRUB_TIMEOUT={{ grub_timeout }}
|
||||
create: yes
|
||||
mode: "0664"
|
||||
when: grub_timeout is defined
|
||||
notify:
|
||||
- update grub
|
||||
|
||||
- name: set GRUB_RECORDFAIL_TIMEOUT
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/default/grub
|
||||
line: GRUB_RECORDFAIL_TIMEOUT={{ grub_recordfail_timeout }}
|
||||
create: yes
|
||||
mode: "0664"
|
||||
when: grub_recordfail_timeout is defined
|
||||
notify:
|
||||
- update grub
|
||||
|
||||
- name: add options to GRUB_CMDLINE_LINUX
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
path: /etc/default/grub
|
||||
regexp: '^GRUB_CMDLINE_LINUX="((:?(?!{{ item.option }}={{ item.value }}).)*?)"$'
|
||||
replace: 'GRUB_CMDLINE_LINUX="\1 {{ item.option }}={{ item.value }}"'
|
||||
regexp: '^GRUB_CMDLINE_LINUX="((:?(?!{{ item.option }}{{ "={}".format(item.value) if item.value is defined else "" }}).)*?)"$'
|
||||
replace: 'GRUB_CMDLINE_LINUX="\1 {{ item.option }}{{ "={}".format(item.value) if item.value is defined else "" }}"'
|
||||
validate: /bin/sh %s
|
||||
mode: "0664"
|
||||
loop: "{{ grub_options }}"
|
||||
|
|
@ -43,5 +47,22 @@
|
|||
- grub_options is defined
|
||||
- grub_options | length > 0
|
||||
|
||||
|
||||
- name: add options to GRUB_CMDLINE_LINUX_DEFAULT
|
||||
ansible.builtin.replace:
|
||||
path: /etc/default/grub
|
||||
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT="((:?(?!{{ item.option }}=?[^s]*).)*?)"$'
|
||||
replace: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 {{ item.option }}{{ "={}".format(item.value) if item.value is defined else "" }}"'
|
||||
validate: /bin/sh %s
|
||||
mode: "0664"
|
||||
loop: "{{ grub_default_options }}"
|
||||
loop_control:
|
||||
label: "{{ item.option }}"
|
||||
notify:
|
||||
- update grub
|
||||
when:
|
||||
- grub_default_options is defined
|
||||
- grub_default_options | length > 0
|
||||
|
||||
- name: flush handlers
|
||||
meta: flush_handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
|
|
|||
18
tox.ini
18
tox.ini
|
|
@ -2,23 +2,23 @@
|
|||
# Ansible managed
|
||||
#
|
||||
[tox]
|
||||
minversion = 3.7
|
||||
envlist = py{38}-ansible-{previous,current}
|
||||
minversion = 3.21.4
|
||||
envlist = py{310}-ansible-{4,5}
|
||||
|
||||
skipsdist = true
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
previous: ansible>=2.9, <2.10
|
||||
current: ansible
|
||||
next: git+https://github.com/ansible/ansible.git@devel
|
||||
molecule[docker]>=3, <4
|
||||
docker>=4.2, <4.3
|
||||
ansible-lint
|
||||
4: ansible == 4.*
|
||||
5: ansible == 5.*
|
||||
molecule[docker]
|
||||
docker == 5.*
|
||||
ansible-lint == 5.*
|
||||
commands = molecule test
|
||||
setenv =
|
||||
TOX_ENVNAME={envname}
|
||||
PY_COLORS=1
|
||||
ANSIBLE_FORCE_COLOR=1
|
||||
ANSIBLE_ROLES_PATH=../
|
||||
|
||||
passenv = namespace image tag
|
||||
passenv = namespace image tag DOCKER_HOST
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ _grub_packages:
|
|||
Debian:
|
||||
- grub2
|
||||
|
||||
grub_packages: "{{ _grub_packages[ansible_os_family] | default(_grub_packages['default']) }}"
|
||||
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
|
||||
|
||||
grub_update_grub_command: "{{ _grub_update_grub_command[ansible_os_family] | default(_grub_update_grub_command['default']) }}"
|
||||
grub_update_grub_command: "{{ _grub_update_grub_command[ansible_os_family] | default(_grub_update_grub_command['default'] ) }}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue