[root@192 ~]# ansible --version
ansible 2.9.11
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
[root@192 ~]# vim /etc/hosts
[root@192 ~]# scp /etc/hosts [email protected]:/etc/hosts
The authenticity of host '192.168.1.191 (192.168.1.191)' can't be established.
ECDSA key fingerprint is SHA256:ZVd4fwX7zxHrxSVxcJNQiZ0fzmEi1a9a+HIbw4pFZeU.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.191' (ECDSA) to the list of known hosts.
[email protected]'s password:
hosts 100% 197 1.4KB/s 00:00
[root@192 ~]# hostnamectl set-hostname node1
Could not set property: Connection timed out
[root@192 ~]# hostnamectl set-hostname node1
[root@192 ~]# su -
Last login: Mon Apr 15 04:32:25 PDT 2024 from 192.168.1.40 on pts/1
[root@node1 etc]# cd /ansible
-bash: cd: /ansible: No such file or directory
[root@node1 etc]# cd /etc/ansible
[root@node1 ansible]# ll
total 24
-rw-r--r--. 1 root root 19985 Jul 21 2020 ansible.cfg
-rw-r--r--. 1 root root 1016 Jul 21 2020 hosts
drwxr-xr-x. 2 root root 6 Jul 21 2020 roles
[root@node1 ansible]# vim ansible.cfg
[root@node1 ansible]# ansible node2 -m shell -a "hostnamectl set-hostname node2" -u root -k
SSH password:
[WARNING]: provided hosts list is empty, only localhost is available. Note that the
implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: node2
^C [ERROR]: User interrupted execution
[root@node1 ansible]# ansible node2 -m shell -a "hostnamectl set-hostname node2" -u root -k
SSH password:
[WARNING]: provided hosts list is empty, only localhost is available. Note that the
implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: node2