ansible下playbook安装httpd

[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

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值