### 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
:kw cwd: If given, working directory to run the command inside
        :kw use_unsafe_shell: See `args` parameter.  Default False
        :kw prompt_regex: Regex string (not a compiled regex) which can be
            used to detect prompts in the stdout which would otherwise cause
            the execution to hang (especially if no input data is specified)
        :kw environ_update: dictionary to *update* environ variables with
        :kw umask: Umask to be used when running the command. Default None
        :kw encoding: Since we return native strings, on python3 we need to
            know the encoding to use to transform from bytes to text.  If you
            want to always get bytes back, use encoding=None.  The default is
            "utf-8".  This does not affect transformation of strings given as
            args.
        :kw errors: Since we return native strings, on python3 we need to
            transform stdout and stderr from bytes to text.  If the bytes are
            undecodable in the ``encoding`` specified, then use this error
            handler to deal with them.  The default is ``surrogate_or_strict``
            which means that the bytes will be decoded using the
            surrogateescape error handler if available (available on all
            python3 versions we support) otherwise a UnicodeError traceback
            will be raised.  This does not affect transformations of strings
            given as args.
        :kw expand_user_and_vars: When ``use_unsafe_shell=False`` this argument
            dictates whether ``~`` is expanded in paths and environment variables
            are expanded before running the command. When ``True`` a string such as
            ``$SHELL`` will be expanded regardless of escaping. When ``False`` and
            ``use_unsafe_shell=False`` no path or variable expansion will be done.
        :kw pass_fds: When running on Python 3 this argument
            dictates which file descriptors should be passed
            to an underlying ``Popen`` constructor. On Python 2, this will
            set ``close_fds`` to False.