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

feat: Make the role work on Debian based systems #130

Closed
wants to merge 1 commit into from
Closed

feat: Make the role work on Debian based systems #130

wants to merge 1 commit into from

Conversation

Thulium-Drake
Copy link
Contributor

Enhancement: Make role work on Debian

Reason: I have a few systems that run Debian and I wanted to configure Postfix on them in the same manner as I do RHEL based systems.

Result: Role now works on Debian (note that SELinux and Firewalld are not supported/tested)

Issue Tracker Tickets (Jira or BZ if any):

@Thulium-Drake Thulium-Drake changed the title Added executable to make the role work on Debian based systems feat: Make the role work on Debian based systems Jun 10, 2024
@spetrosi
Copy link
Contributor

[citest]

@Thulium-Drake
Copy link
Contributor Author

The CI errors don't seem related to this change?

MSG:

The task includes an option with an undefined variable. The error was: list object has no element 1. list object has no element 1

The error appears to be in '/WORKDIR/git-debian_compatiblet52xohsq/.collection/ansible_collections/fedora/linux_system_roles/roles/postfix/tasks/selinux.yml': line 28, column 11, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


        - name: Add the smtp related service ports to _postfix_selinux
          ^ here

	to retry, use: --limit @/tmp/tests_default.retry

@@ -111,6 +111,8 @@
cp /etc/postfix/main.cf
/etc/postfix/main.cf.{{ postfix_backup_multiple |
ternary("$(date -Iseconds)", "backup") }}
args:
executable: /bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Does Debian use some other executable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Debian uses Dash when scripts are run with /bin/sh, and that does not support pipefail as option:

# ls -al $(which sh)
lrwxrwxrwx 1 root root 4 Jan  5  2023 /usr/bin/sh -> dash

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this task copies files, and we can use the copy module instead of using shell. There is an old #2 that nobody looked at for years, but it has some good code that would fix this. Can you use it here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also - if we do want to keep the shell - instead of using a different executable, this is how we solve the pipefail issue with other system roles - https://github.com/linux-system-roles/timesync/blob/main/tests/tests_ntp_provider3.yml#L52-L55 e.g. check if pipefail is a supported option, and set it if it is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am about to merge #2, which will fix the issue with pipefail. This PR now lacks adding compatibility with Debian in meta/main.yml, like in https://github.com/linux-system-roles/ssh/blob/main/meta/main.yml#L18-L23

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, that will also fix it :)

Shall I close this one then?

@richm
Copy link
Contributor

richm commented Jun 11, 2024

Will fix by #2 instead

@richm richm closed this Jun 11, 2024
@Thulium-Drake Thulium-Drake deleted the debian_compatible branch June 17, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants