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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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?

when: postfix_backup or postfix_backup_multiple
changed_when: true

Expand Down
Loading