I suggest you run the 'setup' module against your hosts, and use one of the 
facts to find out if the machine is FS or US.

For windows hosts, ansible_facts.ansible_env.USERNAME might be enough.   If 
that isn't enough, on windows hosts you can use the Get-Culture cmdlet to 
find out which culture is current on your host.  Something like this.

- name: culture test
  hosts: 12,
  gather_facts: false
  tasks:
    - name: get culture
      win_shell: Get-Culture|select Name|convertto-json -depth 1
      register: culture_raw

    - name: debug culture_raw
      debug:
        var: culture_raw

    - name: set culture fact
      set_fact:
         culture: "{{culture_raw.stdout|from_json}}"

    - name: debug culture
      debug:
        var: culture

    - name: do things when culture is en-US
      debug:
        msg: Doing en-US things   
      when: culture.Name == 'en-US'

    - name: do things when culture is something else
      debug:
        msg: Doing non-en-US things   
      when: culture.Name != 'en-US'


On Monday, July 10, 2017 at 4:46:55 PM UTC+1, fanchf...@gmail.com wrote:
>
> Hello,
>
> I would like to create a playbook that adds a user to the administrators 
> group. This action is simple and is an example. But my problem is that I 
> have servers in FR and the group is not administrators but administrators.
>
> I saw that you could make conditions in the playbooks but I do not know 
> how to test if I am on an OS FR or US.
>
> Could you advise me?
>
> Thank you beforehand.
>
> Regards
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a95d7c96-979b-41ca-8c2b-44456ba40813%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to