pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands.
Using files.line to replace single line produces incorrect fact, so the line is never replaced and therefore automatically inserted at the end of the file
## Expected behavior
This code should match line containing `PasswordAuthentication yes` and replace in with `PasswordAuthentication no`
## Meta
+ Consider including output with `-vv` and `--debug`.
This is grep generated by the files.line operation
`sh -c 'grep -e '"'"'^.*.+PasswordAuthentication.+.*$'"'"' /etc/ssh/sshd_config`
Describe the bug
Using
files.line
to replace single line produces incorrect fact, so the line is never replaced and therefore automatically inserted at the end of the fileTo Reproduce
files.line( name="Disable password login", path="/etc/ssh/sshd_config", line="PasswordAuthentication .+", replace="PasswordAuthentication no" )