On 24. feb. 2017 20:40, Stéphane Klein wrote:
is there a solution more user friendly that
http://stackoverflow.com/questions/30786263/only-check-whether-a-line-present-in-a-file-ansible
to test if file contain a string?

I don't like that:

- name: Check if bash-completion in enable for root user
  command: grep -q "/etc/bash_completion" /root/.bashrc
  register: check_bashcompletion_enabled
  ignore_errors: True

- name: Enable bach-completion for root user
  command: cp /etc/skel/.bashrc /root/.bashrc
  when: check_bashcompletion_enabled.rc == 1

Do you know a better solution?

What I would do is put the correct .bashrc in Ansible and just use the copy module to copy it to the host(s).

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8d916175-3bea-c202-b175-8b8967147422%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to