### Summary

I have a playbook as follows:
```
  - name: Change the hostname
    hostname:
      name: example.com
```
I have also tried:

```
  - name: Change the hostname
    hostname:
      name: example.com
      use: systemd
```


Changing hostname on CentOS Stream 8 using the above playbook causes the target machine to log the following output in none stop way:

```
Feb  6 03:43:41 172-105-183-143 NetworkManager[772]: <info>  [1644119021.3649] policy: set-hostname: current hostname was changed outside NetworkManager: 'example.com'
Feb  6 03:43:42 172-105-183-143 NetworkManager[772]: <info>  [1644119022.3647] policy: set-hostname: current hostname was changed outside NetworkManager: 'example.com'
Feb  6 03:43:42 172-105-183-143 NetworkManager[772]: <info>  [1644119022.3651] policy: set-hostname: current hostname was changed outside NetworkManager: 'example.com'
Feb  6 03:43:43 172-105-183-143 NetworkManager[772]: <info>  [1644119023.3646] policy: set-hostname: current hostname was changed outside NetworkManager: 'example.com'
Feb  6 03:43:43 172-105-183-143 NetworkManager[772]: <info>  [1644119023.3649] policy: set-hostname: current hostname was changed outside NetworkManager: 'example.com'
```

However, when I log into the target machine and run the following command, it stops producing unnecessary logs.

```hostnamectl set-hostname example.com```

OS details of the target machine:
```
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"
```

The same issue is also logged here:
https://bugzilla.redhat.com/show_bug.cgi?id=1894137

However, I am not getting the issue when I run the command 'hostnamectl' directly in the box but only when I update the hostname using Ansible playbook.

Ansible version I am using:
```
➜  ~ ansible --version
ansible [core 2.12.2]
  config file = None
  configured module search path = ['/Users/gehendra/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/gehendra/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.8 (main, Nov 10 2021, 09:21:22) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True
```


Your help would be highly appreciated. 
Thank you.






### Issue Type

Bug Report

### Component Name

ansible

### Ansible Version

```console
$ ansible --version
ansible [core 2.12.2]
  config file = None
  configured module search path = ['/Users/gehendra/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/gehendra/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.8 (main, Nov 10 2021, 09:21:22) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True
```


### Configuration

```console
$ ansible-config dump --only-changed
(END)

Nothing was produced at all.
```


### OS / Environment

[ga@example ~]$ cat /etc/os-release
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)

  - name: Change the hostname
    hostname:
      name: example.com

or

  - name: Change the hostname
    hostname:
      name: example.com
      use: systemd
```


### Expected Results

I do not want the garbage/error logs to be written every second.


### Actual Results

```console
No errors are displayed when running the playbook on the control machine.
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
"""
    This is a macOS hostname manipulation strategy class. It uses
    /usr/sbin/scutil to set ComputerName, HostName, and LocalHostName.
    HostName corresponds to what most platforms consider to be hostname.
    It controls the name used on the command line and SSH.
    However, macOS also has LocalHostName and ComputerName settings.
    LocalHostName controls the Bonjour/ZeroConf name, used by services
    like AirDrop. This class implements a method, _scrub_hostname(), that mimics
    the transformations macOS makes on hostnames when enterened in the Sharing
    preference pane. It replaces spaces with dashes and removes all special
    characters.
    ComputerName is the name used for user-facing GUI services, like the
    System Preferences/Sharing pane and when users connect to the Mac over the network.
    """
    def __init__(self, module):