-
Notifications
You must be signed in to change notification settings - Fork 791
Use platform_package_overrides in bash and ansible macros #10626
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fd898bd
feature: bash_package_{install,remove}: support platform_package_over…
maage a525d53
feature: jinja: add filter join_comma_and
maage fe71b46
feature: jinja: add ansible_package_install
maage c3b215e
fix: aide: use ansible_package_install to install packages
maage ec964b6
fix: network-firewalld: use ansible_package_install to install packages
maage ad24b9d
fix: firewalld_sshd_port_enabled: use ansible_package_install to inst…
maage f780086
fix: accounts_passwords_pam_faillock_dir: use ansible_package_install…
maage 4de8613
fix: wireless_disable_interfaces: use ansible_package_install to inst…
maage bb6bcec
fix: fips: use ansible_package_install to install packages
maage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -771,6 +771,37 @@ The following macro remediates Audit syscall rule in :code:`/etc/audit/audit.rul | |
| {{%- endmacro -%}} | ||
|
|
||
|
|
||
| {{# | ||
| Ansible ansible.builtin.package wrapping macro, ensure package(s) are installed | ||
|
|
||
| :param package: Package(s) to ensure are installed | ||
| :type package: str | list[str] | ||
| :param name: Name used in task name. If not set, package names joined with comma and "and". | ||
| :type name: None | str | ||
|
|
||
| #}} | ||
| {{%- macro ansible_package_install(package, name=none) -%}} | ||
| {{%- if (package is sequence) and (package is not mapping) and (package is not string) -%}} | ||
| {{%- set packages = package -%}} | ||
| {{%- else %}} | ||
| {{%- set packages = [package] -%}} | ||
| {{%- endif %}} | ||
| {{%- if name is none %}} | ||
| {{%- set name = "the " ~ (packages | join_comma_and) -%}} | ||
| {{%- endif %}} | ||
| - name: "{{{ rule_title }}} - Ensure {{{ name }}} {{% if packages | length > 1 %}}Packages Are{{% else %}}Package Is{{% endif %}} Installed" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better if the overridden package name would be also used in the task name. |
||
| ansible.builtin.package: | ||
| name: | ||
| {{%- for p in packages %}} | ||
| {{%- if p in platform_package_overrides %}} | ||
| {{%- set p = platform_package_overrides[p] %}} | ||
| {{%- endif %}} | ||
| - "{{{ p }}}" | ||
| {{%- endfor %}} | ||
| state: present | ||
| {{%- endmacro -%}} | ||
|
|
||
|
|
||
| {{# | ||
| Macro used to check if authselect files are intact. When used, it will exit the respective | ||
| script if any authselect file was modified without proper use of authselect tool and | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attention at the task below this. The task uses "when:" statement where the package name will have to be overridden as well