Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep_color doesn't work with ansible script on guest #3891

Closed
melck opened this issue May 23, 2014 · 5 comments
Closed

keep_color doesn't work with ansible script on guest #3891

melck opened this issue May 23, 2014 · 5 comments

Comments

@melck
Copy link

melck commented May 23, 2014

Hi, first sorry for my english !

I want to report a little issue, i'm on windows 7 and i launch ansible provisionning from shell script on guest. I want to keep color like ansible handle it but when i put keep_color, the colors are white and all red if script fails. Do you have a way to workaround this color issue without install plugin?

@mitchellh
Copy link
Contributor

/cc @gildegoma

@gildegoma
Copy link
Collaborator

@melck I think that setting ANSIBLE_FORCE_COLOR=true when running the ansible-playbook command should do the trick (which is actually what the Vagrant Ansible provisioner does):

  config.vm.define 'test' do |machine|

    machine.vm.provision :shell, keep_color: true, :inline => <<EOS
set -e
  cd /vagrant
  PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ansible-playbook -c local -i ... 
EOS

  end

Note that:

  • I couldn't verify it on a Windows host, so you might encounter specific issues related to underlying OS or shell...
  • If not already done, I also recommend you to set PYTHONUNBUFFERED=1 to get fluent log output during the provision execution.
  • I am interested in your experience on Windows host for my current work on Support Ansible “Local Playbooks” #2103 (in other words: I'll need some testers soon ;-)

@melck
Copy link
Author

melck commented May 23, 2014

It's work very well. Thank you.

I will follow your work and i will be glad to test.

@melck melck closed this as completed May 23, 2014
@gildegoma
Copy link
Collaborator

@melck cool, good to hear!

@gildegoma
Copy link
Collaborator

@melck in case you're still interested in this kind of things, please have a look at #5340.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants