Closed ledroide closed 7 years ago
I suggest to replace the shell command with :
( test -r /etc/fstab && find /dev/disk/by-uuid/ -type l -printf "%f\n" | sort | head -1 | grep --ignore-case --only-matching --extended-regexp --max 1 '[0-9a-f]{3,}[0-9a-f-]+' | tr -d '-' || echo '0' ; ifconfig | grep --ignore-case --only-matching --extended-regexp '([0-9a-f]{2}:){5}[0-9a-f]{2}' | tr -d ':' | tr -d '\n') | python -c 'import sys; x, y = sys.stdin.read().split(chr(10))[0:2]; x = int(x, 16); y = int(y, 16); sys.stdout.write((str(x + y)[-9:])); sys.exit(1 if x == 0 and y == 0 else 0)'
Works with CentOS 6.8, CentOS 7.3 and Ubuntu 17.04.
Hey @ledroide,
Thanks for reaching out, I'm totally open to changing this as needed.
Feel free to open a PR and we can fully explore and investigate this.
Best, Jay
Fix for #25 is in PR
Closing this since PR #25 has been merged!
I encountered the issue as well when using release v1.2.0. Do we have a new release contains this fix? Thanks -cl
Thanks for the reminder @kknd22, I just cut v1.3.0.
https://github.com/jaytaylor/ansible-kafka/releases/tag/v1.3.0
File : kafka-cfg.yml task name: "Generate generic unique machine id integer" shell command : ( test -r /etc/fstab && ls -l /dev/disk/by-uuid/ | grep $(mount | grep ' / ' | cut -d' ' -f1 | cut -d'/' -f3) | grep --ignore-case --only-matching --extended-regexp --max 1 '[0-9a-f]{3,}[0-9a-f-]+' | tr -d '-' || echo '0' ; ifconfig | grep --ignore-case --only-matching --extended-regexp '([0-9a-f]{2}:){5}[0-9a-f]{2}' | tr -d ':' | tr -d '\n') | python -c 'import sys; x, y = sys.stdin.read().split(chr(10))[0:2]; x = int(x, 16); y = int(y, 16); sys.stdout.write((str(x + y)[-9:])); sys.exit(1 if x == 0 and y == 0 else 0)'
When I use a non-LVM partition, it works because of :
And this pattern matches with UUID symlink, so you can pick its UUID :
Output code is 0, and that's okay
But with LVM partitioning :
Output code is 1, and string is empty.
So here is the result of the whole shell command with LVM partitioning :
And here is the error when playing role :
Hope it helps you to solve this issue.
Regards, Serge