如何使用 vagrant 启用 ansible playbook 颜色?

问题描述 投票:0回答:1

这是我在 vagrant 文件中的设置:

  config.vm.provision "ansible_local" do |ansible|
    ansible.verbose   = "vv"
    ansible.become    = true # execute as root
    ansible.playbook  = "ansible/playbook.yml"
    # ansible.skip_tags = "once"
    ansible.extra_vars = { ANSIBLE_FORCE_COLOR: true, ANSIBLE_NO_COLOR: false}
  end  

这是我运行时的输出

vagrant up --provision
:

==> default: Running provisioner: ansible_local...
    default: Running ansible-playbook...
cd /vagrant && PYTHONUNBUFFERED=1 ANSIBLE_NOCOLOR=true ansible-playbook --limit="default" --inventory-file=/tmp/vagrant-ansible/inventory --extra-vars=\{\"ANSIBLE_FORCE_COLOR\":\"true\",\"ANSIBLE_NO_COLOR\":\"false\"\} --become -vv ansible/playbook.yml
ansible-playbook 2.9.6

控制台中未显示颜色。

ansible vagrant vagrantfile
1个回答
0
投票

这个答案可能有点晚了,但对我来说有效:

force_color = True

/etc/ansible/ansible.cfg 的[默认值]部分 这是使用 ansible [core 2.15.5] 和 Vagrant 2.3.7。

© www.soinside.com 2019 - 2024. All rights reserved.