Answer the question
In order to leave comments, you need to log in
Ansible and `uname -r` or $(uname -r) runs on localhost. Why?
Faced such a bug (or feature?):
when trying to execute the command
ansible group01 -m apt -s -a "name=linux-headers-`uname -r` state=present"
ansible group01 -m apt -s -a "name=linux-headers-$(uname -r) state=present"
hostXXX | FAILED >> {
"failed": true,
"msg": "No package matching 'linux-headers-16.1.0' is available"
}
4.2.0-42-generic
16.1.0
Answer the question
In order to leave comments, you need to log in
There was a discussion, but someone deleted it, they suggested a solution:
Melkij left a comment on the answer to the Ansible question and `uname -r` or $(uname -r) works on the local host. Why?
As a result, it turned out to be like this:
ansible a-install -m raw -s -a "apt install -y linux-headers-$(uname\ -r)"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question