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 new system module: efi_boot to provide easy management of EFI bootloaders. #37283

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
3 participants
@wrouesnel
Contributor

wrouesnel commented Mar 12, 2018

SUMMARY

Adds the efi_boot module, which wraps the efibootmgr command to provide idempotent bootloader management on EFI systems.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

efi_boot

ANSIBLE VERSION
ansible 2.6.0 (devel 6074d2f79f) last updated 2018/02/23 17:50:27 (GMT +1100)
  config file = None
  configured module search path = [u'/home/will/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/will/src/ansible-work/ansible/lib/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]
ADDITIONAL INFORMATION

Managing bootloaders via the OS on most systems can be accomplished by efibootmgr, but it does not present the easiest interface for idempotent handling of the matter. This module wraps the interface to provide an ansible-like interface for bootloader management - it will idempotentently add named entries (provided the boot contents match) and optionally remove name-conflicts (a common use case when propagating changes via this module).

- name: installing efi boot entry
  efi_boot:
    name: Linux
    device: "{{root_disk}}"
    partition: 2
    bootloader: \EFI\{{ansible_distribution|lower}}\efilinux.efi
    state: present
    remove_name_conflicts: true

I have been successfully using it to effect bare-metal provisioning of systems where a number of development and update cycles were necessary.

@ansibot

This comment has been minimized.

Contributor

ansibot commented Mar 12, 2018

The test ansible-test sanity --test pylint [explain] failed with 14 errors:

lib/ansible/modules/system/efi_boot.py:114:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:118:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:126:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:129:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:133:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:168:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:169:3: singleton-comparison Comparison to True should be just 'expr' or 'expr is True'
lib/ansible/modules/system/efi_boot.py:177:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:180:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:213:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:216:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:217:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:219:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/system/efi_boot.py:229:0: trailing-newlines Trailing newlines

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test boilerplate [explain] failed with 2 errors:

lib/ansible/modules/system/efi_boot.py:0:0: missing: __metaclass__ = type
lib/ansible/modules/system/efi_boot.py:0:0: missing: from __future__ import (absolute_import, division, print_function)

The test ansible-test sanity --test no-underscore-variable [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:82:17: use `dummy` instead of `_` for a variable name

The test ansible-test sanity --test pep8 [explain] failed with 61 errors:

lib/ansible/modules/system/efi_boot.py:107:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/system/efi_boot.py:114:24: W291 trailing whitespace
lib/ansible/modules/system/efi_boot.py:118:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:126:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:129:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:132:56: E231 missing whitespace after ','
lib/ansible/modules/system/efi_boot.py:133:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:135:34: E201 whitespace after '{'
lib/ansible/modules/system/efi_boot.py:135:41: E203 whitespace before ':'
lib/ansible/modules/system/efi_boot.py:135:80: E203 whitespace before ':'
lib/ansible/modules/system/efi_boot.py:135:89: E202 whitespace before '}'
lib/ansible/modules/system/efi_boot.py:138:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/system/efi_boot.py:147:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:147:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:148:13: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:148:13: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:148:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:148:41: E241 multiple spaces after ','
lib/ansible/modules/system/efi_boot.py:149:14: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:149:14: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:149:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:149:41: E241 multiple spaces after ','
lib/ansible/modules/system/efi_boot.py:150:15: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:150:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:150:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:150:42: E241 multiple spaces after ','
lib/ansible/modules/system/efi_boot.py:151:18: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:151:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:151:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:151:42: E241 multiple spaces after ','
lib/ansible/modules/system/efi_boot.py:152:19: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:152:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:152:42: E241 multiple spaces after ','
lib/ansible/modules/system/efi_boot.py:153:30: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:153:32: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:159:5: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:160:6: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:161:7: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:162:10: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:163:11: E221 multiple spaces before operator
lib/ansible/modules/system/efi_boot.py:166:27: E231 missing whitespace after ','
lib/ansible/modules/system/efi_boot.py:168:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:169:26: E712 comparison to True should be 'if cond is True:' or 'if cond:'
lib/ansible/modules/system/efi_boot.py:177:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:180:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:188:7: E225 missing whitespace around operator
lib/ansible/modules/system/efi_boot.py:211:35: E201 whitespace after '{'
lib/ansible/modules/system/efi_boot.py:211:45: E203 whitespace before ':'
lib/ansible/modules/system/efi_boot.py:211:74: E203 whitespace before ':'
lib/ansible/modules/system/efi_boot.py:211:76: E241 multiple spaces after ':'
lib/ansible/modules/system/efi_boot.py:211:119: E202 whitespace before '}'
lib/ansible/modules/system/efi_boot.py:213:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:216:105: W291 trailing whitespace
lib/ansible/modules/system/efi_boot.py:217:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:219:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:222:52: E201 whitespace after '{'
lib/ansible/modules/system/efi_boot.py:222:62: E203 whitespace before ':'
lib/ansible/modules/system/efi_boot.py:222:81: E203 whitespace before ':'
lib/ansible/modules/system/efi_boot.py:222:83: E241 multiple spaces after ':'
lib/ansible/modules/system/efi_boot.py:222:93: E202 whitespace before '}'
lib/ansible/modules/system/efi_boot.py:229:1: W391 blank line at end of file

The test ansible-test sanity --test validate-modules [explain] failed with 16 errors:

lib/ansible/modules/system/efi_boot.py:0:0: E101 Interpreter line is not "#!/usr/bin/python"
lib/ansible/modules/system/efi_boot.py:0:0: E103 Did not find a call to main()
lib/ansible/modules/system/efi_boot.py:0:0: E305 DOCUMENTATION.description: required key not provided @ data['description']. Got None
lib/ansible/modules/system/efi_boot.py:0:0: E310 No EXAMPLES provided
lib/ansible/modules/system/efi_boot.py:0:0: E312 No RETURN provided
lib/ansible/modules/system/efi_boot.py:0:0: E316 ANSIBLE_METADATA.metadata_version: required key not provided @ data['metadata_version']. Got None
lib/ansible/modules/system/efi_boot.py:0:0: E316 ANSIBLE_METADATA.version: extra keys not allowed @ data['version']. Got '0.1'
lib/ansible/modules/system/efi_boot.py:0:0: E317 "name" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/system/efi_boot.py:0:0: E317 "state" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "bootloader" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "device" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "name" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "partition" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "state" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E325 argument_spec for "remove_name_conflicts" defines type="bool" but documentation does not
lib/ansible/modules/system/efi_boot.py:228:0: E109 Next to last line should be: if __name__ == "__main__":

click here for bot help

@bcoca bcoca removed the needs_triage label Mar 13, 2018

@wrouesnel wrouesnel force-pushed the wrouesnel:efi_boot_mangement branch Mar 16, 2018

@ansibot ansibot removed the ci_verified label Mar 16, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Mar 16, 2018

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:176:3: singleton-comparison Comparison to True should be just 'expr' or 'expr is True'

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test boilerplate [explain] failed with 2 errors:

lib/ansible/modules/system/efi_boot.py:0:0: missing: __metaclass__ = type
lib/ansible/modules/system/efi_boot.py:0:0: missing: from __future__ import (absolute_import, division, print_function)

The test ansible-test sanity --test no-underscore-variable [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:83:17: use `dummy` instead of `_` for a variable name

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

lib/ansible/modules/system/efi_boot.py:176:26: E712 comparison to True should be 'if cond is True:' or 'if cond:'
lib/ansible/modules/system/efi_boot.py:216:17: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:244:17: E251 unexpected spaces around keyword / parameter equals

The test ansible-test sanity --test validate-modules [explain] failed with 15 errors:

lib/ansible/modules/system/efi_boot.py:0:0: E101 Interpreter line is not "#!/usr/bin/python"
lib/ansible/modules/system/efi_boot.py:0:0: E103 Did not find a call to main()
lib/ansible/modules/system/efi_boot.py:0:0: E305 DOCUMENTATION.description: required key not provided @ data['description']. Got None
lib/ansible/modules/system/efi_boot.py:0:0: E310 No EXAMPLES provided
lib/ansible/modules/system/efi_boot.py:0:0: E312 No RETURN provided
lib/ansible/modules/system/efi_boot.py:0:0: E316 ANSIBLE_METADATA.metadata_version: required key not provided @ data['metadata_version']. Got None
lib/ansible/modules/system/efi_boot.py:0:0: E316 ANSIBLE_METADATA.version: extra keys not allowed @ data['version']. Got '0.1'
lib/ansible/modules/system/efi_boot.py:0:0: E317 "name" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/system/efi_boot.py:0:0: E317 "state" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "bootloader" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "device" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "name" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "partition" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E324 Value for "default" from the argument_spec (None) for "state" does not match the documentation ('None')
lib/ansible/modules/system/efi_boot.py:0:0: E325 argument_spec for "remove_name_conflicts" defines type="bool" but documentation does not

click here for bot help

@ansibot ansibot added the ci_verified label Mar 16, 2018

Add new system module: efi_boot to provide easy management of EFI boo…
…tloaders.

Adds the efi_boot module, which wraps the efibootmgr command to provide
idempotent bootloader management on EFI systems.

@wrouesnel wrouesnel force-pushed the wrouesnel:efi_boot_mangement branch to 53a263d Mar 16, 2018

@ansibot ansibot removed the ci_verified label Mar 16, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Mar 16, 2018

The test ansible-test sanity --test pylint [explain] failed with 7 errors:

lib/ansible/modules/system/efi_boot.py:71:0: anomalous-backslash-in-string Anomalous backslash in string: '\E'. String constant might be missing an r prefix.
lib/ansible/modules/system/efi_boot.py:71:0: anomalous-backslash-in-string Anomalous backslash in string: '\E'. String constant might be missing an r prefix.
lib/ansible/modules/system/efi_boot.py:71:0: anomalous-backslash-in-string Anomalous backslash in string: '\g'. String constant might be missing an r prefix.
lib/ansible/modules/system/efi_boot.py:71:0: anomalous-backslash-in-string Anomalous backslash in string: '\g'. String constant might be missing an r prefix.
lib/ansible/modules/system/efi_boot.py:71:0: anomalous-backslash-in-string Anomalous backslash in string: '\g'. String constant might be missing an r prefix.
lib/ansible/modules/system/efi_boot.py:71:0: anomalous-backslash-in-string Anomalous backslash in string: '\g'. String constant might be missing an r prefix.
lib/ansible/modules/system/efi_boot.py:211:7: singleton-comparison Comparison to True should be just 'expr' or 'expr is True'

The test ansible-test sanity --test boilerplate [explain] failed with 2 errors:

lib/ansible/modules/system/efi_boot.py:0:0: missing: __metaclass__ = type
lib/ansible/modules/system/efi_boot.py:0:0: missing: from __future__ import (absolute_import, division, print_function)

The test ansible-test sanity --test no-underscore-variable [explain] failed with 1 error:

lib/ansible/modules/system/efi_boot.py:116:17: use `dummy` instead of `_` for a variable name

The test ansible-test sanity --test pep8 [explain] failed with 6 errors:

lib/ansible/modules/system/efi_boot.py:29:13: W291 trailing whitespace
lib/ansible/modules/system/efi_boot.py:81:1: W293 blank line contains whitespace
lib/ansible/modules/system/efi_boot.py:93:32: W291 trailing whitespace
lib/ansible/modules/system/efi_boot.py:211:30: E712 comparison to True should be 'if cond is True:' or 'if cond:'
lib/ansible/modules/system/efi_boot.py:251:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/efi_boot.py:280:21: E251 unexpected spaces around keyword / parameter equals

The test ansible-test sanity --test validate-modules [explain] failed with 3 errors:

lib/ansible/modules/system/efi_boot.py:0:0: E312 No RETURN provided
lib/ansible/modules/system/efi_boot.py:0:0: E317 "name" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/system/efi_boot.py:0:0: E317 "state" is marked as required but specifies a default. Arguments with a default should not be marked as required

click here for bot help

@ansibot ansibot added the ci_verified label Mar 16, 2018

@ansibot ansibot added the stale_ci label Mar 24, 2018

@ansibot ansibot added the affects_2.6 label May 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment