### 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
os.rename(b_tmp_dest_name, b_dest)
                            except (shutil.Error, OSError, IOError) as e:
                                if unsafe_writes and e.errno == errno.EBUSY:
                                    self._unsafe_writes(b_tmp_dest_name, b_dest)
                                else:
                                    self.fail_json(msg='Unable to make %s into to %s, failed final rename from %s: %s' %
                                                       (src, dest, b_tmp_dest_name, to_native(e)), exception=traceback.format_exc())
                        except (shutil.Error, OSError, IOError) as e:
                            if unsafe_writes:
                                self._unsafe_writes(b_src, b_dest)
                            else:
                                self.fail_json(msg='Failed to replace file: %s to %s: %s' % (src, dest, to_native(e)), exception=traceback.format_exc())
                    finally:
                        self.cleanup(b_tmp_dest_name)
        if creating:
            
            
            umask = os.umask(0)
            os.umask(umask)
            os.chmod(b_dest, DEFAULT_PERM & ~umask)
            try:
                os.chown(b_dest, os.geteuid(), os.getegid())
            except OSError:
                
                
                pass
        if self.selinux_enabled():
            
            self.set_context_if_different(dest, context, False)
    def _unsafe_writes(self, src, dest):