mirror of
https://github.com/nicolabs/ansible-role-grub.git
synced 2026-04-20 02:44:11 +02:00
Compare commits
105 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 | ||
|
|
d8f75fe5d1 | ||
|
|
959ee144ab | ||
|
|
f25bb96a87 | ||
|
|
c826541ba7 | ||
|
|
1918370438 | ||
|
|
902c3f3a95 | ||
|
|
d32a85d2e9 | ||
|
|
2b62233918 | ||
|
|
d528c582c0 | ||
|
|
f095435bef | ||
|
|
4ab0b548ff | ||
|
|
ae20a8d282 | ||
|
|
a1600447a9 | ||
|
|
e1cd2c75c2 | ||
|
|
fcd10a25f0 | ||
|
|
4d068582d5 | ||
|
|
f11ca2faad | ||
|
|
9a3e8a5c48 | ||
|
|
3a10c6c63f | ||
|
|
b506730119 | ||
|
|
93fb3616cd | ||
|
|
e330f8f02e | ||
|
|
2430a50260 |
|
|
@ -1,6 +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
|
||||
|
|
|
|||
1
.github/settings.yml
vendored
1
.github/settings.yml
vendored
|
|
@ -5,3 +5,4 @@
|
|||
repository:
|
||||
description: Configure grub on your system.
|
||||
homepage: https://robertdebock.nl/
|
||||
topics: grub, ansible, molecule, tox, playbook, hacktoberfest
|
||||
|
|
|
|||
12
.github/workflows/galaxy.yml
vendored
12
.github/workflows/galaxy.yml
vendored
|
|
@ -6,17 +6,13 @@
|
|||
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.0.1
|
||||
uses: robertdebock/galaxy-action@1.1.0
|
||||
with:
|
||||
galaxy_api_key: ${{ secrets.galaxy_api_key }}
|
||||
|
|
|
|||
27
.github/workflows/molecule.yml
vendored
27
.github/workflows/molecule.yml
vendored
|
|
@ -11,52 +11,48 @@ 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.1
|
||||
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: "alpine"
|
||||
tag: "edge"
|
||||
- image: "centos"
|
||||
tag: "7"
|
||||
- image: "centos"
|
||||
- image: "enterpriselinux"
|
||||
tag: "latest"
|
||||
- image: "debian"
|
||||
tag: "latest"
|
||||
- image: "debian"
|
||||
tag: "bullseye"
|
||||
tag: "bookworm"
|
||||
- image: "fedora"
|
||||
tag: "31"
|
||||
tag: "34"
|
||||
- image: "fedora"
|
||||
tag: "latest"
|
||||
- image: "fedora"
|
||||
tag: "rawhide"
|
||||
- image: "opensuse"
|
||||
tag: "latest"
|
||||
- image: "ubuntu"
|
||||
tag: "latest"
|
||||
- image: "ubuntu"
|
||||
tag: "bionic"
|
||||
- image: "ubuntu"
|
||||
tag: "xenial"
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
|
@ -67,10 +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.1
|
||||
uses: robertdebock/molecule-action@4.0.7
|
||||
with:
|
||||
image: ${{ matrix.config.image }}
|
||||
tag: ${{ matrix.config.tag }}
|
||||
options: "--parallel all"
|
||||
env:
|
||||
TOX_PARALLEL_NO_SPINNER: 1
|
||||
|
|
|
|||
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
|
||||
24
.pre-commit-config.yaml
Normal file
24
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.0.1
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-added-large-files
|
||||
|
||||
- repo: https://github.com/adrienverge/yamllint
|
||||
rev: v1.26.3
|
||||
hooks:
|
||||
- id: yamllint
|
||||
args: [-c=.yamllint]
|
||||
|
||||
- repo: https://github.com/robertdebock/pre-commit
|
||||
rev: v1.4.4
|
||||
hooks:
|
||||
- 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
|
|
@ -4,40 +4,26 @@
|
|||
#
|
||||
language: python
|
||||
|
||||
os: linux
|
||||
dist: xenial
|
||||
|
||||
python:
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
global:
|
||||
namespace="robertdebock"
|
||||
matrix:
|
||||
- image="alpine" tag="latest"
|
||||
- image="alpine" tag="edge"
|
||||
- image="centos" tag="7"
|
||||
- image="centos" tag="latest"
|
||||
- image="debian" tag="latest"
|
||||
- image="debian" tag="bullseye"
|
||||
- image="fedora" tag="31"
|
||||
- image="fedora" tag="latest"
|
||||
- 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 --parallel all
|
||||
- yamllint .
|
||||
- ansible-lint
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
slack: "BEAf5JsdWsje2YBWtcq0xmdkz1MqCPN0essozaZjUJDSB2LH/DTzdihaakr4peeBdd9Xmus9aiMras8nNRgXHEw1zmm5cc7B95+zlDST82W/oTtA6kXo+mEdvWbQT9VPwZAB+5Vt9PLL3YgRjJ9lmBvGJ84yKm6sRkt5doykr3MGFJSgOtUTADjOh22GZESSXizQQyNOV8fvEEfez5TXEkwigyM1iKMeIkWCWDYHXdSUhAP6PVA+GghObI9/6gcJzieK6NqD7FNKPyOtDQk/y+cNC4xdOEKoCD7/OVmCm0iTkW1qjBkBo94bu08DfZn2Ee9/pAgNN/4PJz7KABAtDmBmSBWiLpvuQ9mzkBKQ08Qa9tyAiJiIgSYyvqjNf0mal3muzAn1cQIuwDSrYq8VklcF8zW0oYrw6GCqvVSe2uf9bAwLNBZylWIucdRYK5oScP8V+v19p0Mp/vz3uYJOeErf5QE7YORDsYGcUBokJmGWIqLtdbAUTq41FMTycqzUIdQLEqUZx0QcfoSPoF50/tQ+cuq9MxIORvc8kzO8v4KYHcE3Ji78M2UY/LhpnI5h+xFjmQ4YsTvOTX6N0+jprFUjhJZjdn7h2DJxinA1cTqoGxyrzvLIJKb5rEQr4uZkstGtx1UjGYMMZprK2MiJkqoJKrSHrF/p/RIxSTmeY0k="
|
||||
email: false
|
||||
|
|
|
|||
|
|
@ -10,3 +10,7 @@ rules:
|
|||
level: error
|
||||
line-length: disable
|
||||
truthy: disable
|
||||
|
||||
ignore: |
|
||||
.tox/
|
||||
.cache/
|
||||
|
|
|
|||
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.
|
||||
|
|
|
|||
93
README.md
93
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 may need to be prepared 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,36 +38,23 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`:
|
|||
|
||||
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
|
||||
```
|
||||
|
||||
For verification `molecule/resources/verify.yml` run after the role has been applied.
|
||||
```yaml
|
||||
---
|
||||
- name: Verify
|
||||
hosts: all
|
||||
become: yes
|
||||
gather_facts: yes
|
||||
|
||||
tasks:
|
||||
- name: check that bogus options are in
|
||||
command: grep 'a=1' /etc/default/grub
|
||||
|
||||
- name: check that selected option is in
|
||||
command: grep 'cgroup_enable=memory' /etc/default/grub
|
||||
mode: "0664"
|
||||
```
|
||||
|
||||
Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles.
|
||||
|
||||
## [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
|
||||
|
|
@ -84,23 +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).
|
||||
|
||||
The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`:
|
||||
## [Status of used roles](#status-of-requirements)
|
||||
|
||||
```yaml
|
||||
---
|
||||
- robertdebock.bootstrap
|
||||
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://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)
|
||||
|
||||
|
|
@ -109,59 +95,26 @@ 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|
|
||||
|fedora|31, 32|
|
||||
|el|8|
|
||||
|debian|all|
|
||||
|fedora|all|
|
||||
|opensuse|all|
|
||||
|ubuntu|focal, bionic, xenial|
|
||||
|ubuntu|all|
|
||||
|
||||
The minimum version of Ansible required is 2.8 but tests have been done to:
|
||||
The minimum version of Ansible required is 2.10, tests have been done to:
|
||||
|
||||
- The previous version, on version lower.
|
||||
- The previous version.
|
||||
- The current version.
|
||||
- The development version.
|
||||
|
||||
|
||||
|
||||
## [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,10 +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.8
|
||||
min_ansible_version: "2.10"
|
||||
|
||||
platforms:
|
||||
- name: Alpine
|
||||
|
|
@ -12,28 +14,21 @@ galaxy_info:
|
|||
- all
|
||||
- name: EL
|
||||
versions:
|
||||
- 7
|
||||
- 8
|
||||
- name: Debian
|
||||
versions:
|
||||
- buster
|
||||
- bullseye
|
||||
- all
|
||||
- name: Fedora
|
||||
versions:
|
||||
- 31
|
||||
- 32
|
||||
- all
|
||||
- name: OpenSUSE
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- focal
|
||||
- bionic
|
||||
- xenial
|
||||
- all
|
||||
|
||||
galaxy_tags:
|
||||
- grub
|
||||
- centos
|
||||
- redhat
|
||||
|
||||
dependencies: []
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ dependency:
|
|||
name: galaxy
|
||||
options:
|
||||
role-file: requirements.yml
|
||||
requirements-file: requirements.yml
|
||||
lint: |
|
||||
PATH=${PATH}
|
||||
yamllint molecule/default/converge.yml
|
||||
ansible-lint molecule/default/converge.yml
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint
|
||||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
|
|
@ -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,10 +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"
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@
|
|||
- name: Verify
|
||||
hosts: all
|
||||
become: yes
|
||||
gather_facts: yes
|
||||
gather_facts: no
|
||||
|
||||
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,2 +1,4 @@
|
|||
---
|
||||
- robertdebock.bootstrap
|
||||
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,36 +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 }}"
|
||||
|
|
@ -42,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
|
||||
|
|
|
|||
22
tox.ini
22
tox.ini
|
|
@ -2,25 +2,23 @@
|
|||
# Ansible managed
|
||||
#
|
||||
[tox]
|
||||
minversion = 3.7
|
||||
# Disabled "next" because of:
|
||||
# https://github.com/ansible-community/molecule/issues/2626.
|
||||
# envlist = py{38}-ansible-{previous,current,next}
|
||||
envlist = py{38}-ansible-{previous,current}
|
||||
minversion = 3.21.4
|
||||
envlist = py{310}-ansible-{4,5}
|
||||
|
||||
skipsdist = true
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
previous: ansible>=2.8, <2.9
|
||||
current: ansible>=2.9
|
||||
next: git+https://github.com/ansible/ansible.git@devel
|
||||
molecule[lint]>=3, <4
|
||||
docker>=4.2, <4.3
|
||||
4: ansible == 4.*
|
||||
5: ansible == 5.*
|
||||
molecule[docker]
|
||||
docker == 5.*
|
||||
ansible-lint == 5.*
|
||||
commands = molecule test
|
||||
setenv =
|
||||
TOX_ENVNAME={envname}
|
||||
MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{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