如何解决弃用问题?

时间:2019-05-27 21:01:20

标签: ansible

我正在为IT自动化创建Ansible Playbook。

这是控制台输出,我得到:

Apache web server.

web.yml
- hosts: 192.168.1.80
  remote_user: ksouthall
  become: yes
  become_method: sudo

  tasks:
  - name: Install Apache
    apt:
      name: apache2
      update_cache: yes
  - name: Copying the demo file
    template: src=/etc/ansible/index.html dest=/var/www/html
              owner=www-data group=www-data mode=0644


ansible-playbook web.yml -f 1 --ask-become-pass
BECOME password:
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters
in group names by default, this will change, but still be user configurable on deprecation. This
feature will be removed in version 2.10. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
 [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see
details

 [WARNING]: Could not match supplied host pattern, ignoring: 192.168.1.80


PLAY [192.168.1.80] ******************************************************************************
skipping: no hosts matched

PLAY RECAP ******************************************************************************

问题:“ BECOME”密码是我的系统密码吗?

2 个答案:

答案 0 :(得分:2)

对于--ask-become-pass,您需要在远程框中输入用户密码(假设您在该框中具有root级特权)。

答案 1 :(得分:1)

库存组名称中最有可能出现破折号。

检查清单文件(默认为/ etc / ansible / hosts),并从组名中删除无效字符,这些字符不是字母数字下划线被视为无效。 (以数字开头的组名也无效)

请参阅:

https://github.com/ansible/ansible/blob/v2.8.0/lib/ansible/config/base.yml#L1489

https://github.com/ansible/ansible/blob/v2.8.0/lib/ansible/constants.py#L122