I have written a playbook task in ansible. I am able to run the playbook on linux end.

```
- name: Set paths for go
      blockinfile:
        path: $HOME/.profile
        backup: yes
        state: present
        block: |
          export PATH=$PATH:/usr/local/go/bin
          export GOPATH=$HOME/go
          export FABRIC_CFG_PATH=$HOME/.fabdep/config

    - name: Load Env variables
      shell: source $HOME/.profile
      args:
        executable: /bin/bash
      register: source_result
      become: yes

```

As in linux we have `.profile` in home directory but in Mac there is no `.profile` and `.bash_profile` in macOS. 

So I want to check if os is Mac then path should be `$HOME/.bash_profile` and if os is linux based then it should look for `$HOME/.profile`. 

I have tried adding 

```
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'precise'

```

But it does not work firstly and also it is length process. I want to get path based on os in a variable and use it.

Thanks