如何解决弃用问题?

5 ansible

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

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

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 ******************************************************************************
Run Code Online (Sandbox Code Playgroud)

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

Eje*_*jez 5

您的库存组名称中很可能有破折号。

检查清单文件(默认为/ 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


小智 2

因为--ask-become-pass您需要在远程机器上输入用户的密码(假设您在该机器上具有 root 级别权限)。