### Summary

https://github.com/ansible/ansible/issues/31982 is back.



### Issue Type

Bug Report

### Component Name

lineinfile

### Ansible Version

```console
$ ansible --version
ansible 2.10.8
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.7 (default, Sep 10 2021, 14:59:43) [GCC 11.2.0]
```


### Configuration

```console
$ ansible-config dump --only-changed
$
```


### OS / Environment

Ubuntu 21.10 Server in a VirtualBox, on server and clients, nothing special

### Steps to Reproduce

```
- name: "Check DNS configuration: Remove search list"
  ansible.builtin.lineinfile:
    backup: "yes"
    path: "/etc/resolv.conf"
    line: "search x.tld"
    state: "absent"

- name: "Check DNS configuration: Cache servers present"
  ansible.builtin.lineinfile:
    backup: "yes"
    line: "{{ item }}"
    path: "/etc/resolv.conf"
    state: "present"
  with_items:
    - "nameserver x.x.x.x"
    - "nameserver y.y.y.y"
```

### Expected Results

The file is modified, a backup is created.

### Actual Results

```console
<x.x.x.x> (1, b'\r\n{"path": "/etc/resolv.conf.2410.2022-01-11@10:36:56~", "details": "Error while setting attributes: /etc/resolv.conf.2410.2022-01-11@10:36:56~: Operation not supported\\n", "exception": "Traceback (most recent call last):\\n  File \\"/tmp/ansible_ansible.builtin.lineinfile_payload_pvwbc704/ansible_ansible.builtin.lineinfile_payload.zip/ansible/module_utils/basic.py\\", line 1256, in set_attributes_if_different\\n    raise Exception(\\"Error while setting attributes: %s\\" % (out + err))\\nException: Error while setting attributes: /etc/resolv.conf.2410.2022-01-11@10:36:56~: Operation not supported\\n\\n", "failed": true, "msg": "chattr failed", "uid": 101, "gid": 103, "owner": "systemd-resolve", "group": "systemd-resolve", "mode": "0644", "state": "file", "size": 920, "invocation": {"module_args": {"backup": true, "line": "nameserver x.x.x.x", "path": "/etc/resolv.conf", "state": "present", "backrefs": false, "create": false, "firstmatch": false, "unsafe_writes": false, "regexp": null, "insertafter": null, "insertbefore": null, "validate": null, "mode": null, "owner": null, "group": null, "seuser": null, "serole": null, "selevel": null, "setype": null, "attributes": null}}}\r\n', b'Shared connection to x.x.x.x closed.\r\n')
<x.x.x.x> Failed to connect to the host via ssh: Shared connection to x.x.x.x closed.
<x.x.x.x> ESTABLISH SSH CONNECTION FOR USER: root
<x.x.x.x> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/4c20d84404 x.x.x.x '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1641897416.2652106-3817-66846454678877/ > /dev/null 2>&1 && sleep 0'"'"''
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_ansible.builtin.lineinfile_payload_bccsus14/ansible_ansible.builtin.lineinfile_payload.zip/ansible/module_utils/basic.py", line 1256, in set_attributes_if_different
    raise Exception("Error while setting attributes: %s" % (out + err))
Exception: Error while setting attributes: /etc/resolv.conf.2577.2022-01-11@10:36:56~: Operation not supported

failed: [x.x.x.x] (item=nameserver x.x.x.x) => {
    "ansible_loop_var": "item",
    "changed": false,
    "details": "Error while setting attributes: /etc/resolv.conf.2577.2022-01-11@10:36:56~: Operation not supported\n",
    "gid": 103,
    "group": "systemd-resolve",
    "invocation": {
        "module_args": {
            "attributes": null,
            "backrefs": false,
            "backup": true,
            "create": false,
            "firstmatch": false,
            "group": null,
            "insertafter": null,
            "insertbefore": null,
            "line": "nameserver x.x.x.x",
            "mode": null,
            "owner": null,
            "path": "/etc/resolv.conf",
            "regexp": null,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "state": "present",
            "unsafe_writes": false,
            "validate": null
        }
    },
    "item": "nameserver x.x.x.x",
    "mode": "0644",
    "msg": "chattr failed",
    "owner": "systemd-resolve",
    "path": "/etc/resolv.conf.2577.2022-01-11@10:36:56~",
    "size": 946,
    "state": "file",
    "uid": 101
}
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
return self._clean
    def _restore_signal_handlers(self):
        
        if PY2 and sys.platform != 'win32':
            signal.signal(signal.SIGPIPE, signal.SIG_DFL)
    def run_command(self, args, check_rc=False, close_fds=True, executable=None, data=None, binary_data=False, path_prefix=None, cwd=None,
                    use_unsafe_shell=False, prompt_regex=None, environ_update=None, umask=None, encoding='utf-8', errors='surrogate_or_strict',
                    expand_user_and_vars=True, pass_fds=None, before_communicate_callback=None, ignore_invalid_cwd=True, handle_exceptions=True):
        '''
        Execute a command, returns rc, stdout, and stderr.
        The mechanism of this method for reading stdout and stderr differs from
        that of CPython subprocess.Popen.communicate, in that this method will
        stop reading once the spawned command has exited and stdout and stderr
        have been consumed, as opposed to waiting until stdout/stderr are
        closed. This can be an important distinction, when taken into account
        that a forked or backgrounded process may hold stdout or stderr open
        for longer than the spawned command.
        :arg args: is the command to run
            * If args is a list, the command will be run with shell=False.
            * If args is a string and use_unsafe_shell=False it will split args to a list and run with shell=False
            * If args is a string and use_unsafe_shell=True it runs with shell=True.
        :kw check_rc: Whether to call fail_json in case of non zero RC.
            Default False
        :kw close_fds: See documentation for subprocess.Popen(). Default True
        :kw executable: See documentation for subprocess.Popen(). Default None
        :kw data: If given, information to write to the stdin of the command
        :kw binary_data: If False, append a newline to the data.  Default False
        :kw path_prefix: If given, additional path to find the command in.
            This adds to the PATH environment variable so helper commands in
            the same directory can also be found