This really helped me. Thank you Brian

On Monday, October 17, 2016 at 12:15:35 PM UTC-5, Kane Kennedy wrote:
>
> Hi can anyone help, this is doing my nut in.  
>
> I cannot get the correct repo to install dependent on the OS family and 
> release, I have 7 repos and need to identify RHEL, SL and Oracle v 5, 6 
> (x86 or x64) and 7.  
> All our servers patch from local repositories, none are allowed direct 
> access to the outside world. 
> As you can see i have tried the when statement in the two ways I have seen 
> in the docs.  Removing the WHEN statement installs the repo file fine, as 
> you can appreciate I dont want to be installing incorrect repo files onto 
> production systems.
>
> [root@xxxxx]# ansible --version
> ansible 2.1.2.0
>   config file = /etc/ansible/roles/xxxx/ansible.cfg
>   configured module search path = Default w/o overrides
>
>
> playbook - snipped
>
>
> - hosts: patch-test
>   tasks:
>
>   - debug:
>       msg: "System {{ inventory_hostname }} is {{ ansible_distribution }} 
> major vession {{ ansible_distribution_major_version }}"
>  
>  - name: Enable Scientific Linux 6 x86 local repo
>     yum_repository:
>      name: Scientific_Linux_6_x86_Local
>      description: Scientific_Linux_6-32
>      file: Scientific_linux
>      baseurl: http://burkrules/repos/sl6-32
>      gpgcheck: no
>      when: ansible_distribution == "Scientific" and 
> ansible_distribution_major_version == "6" and ansible_architecture == "i386"
>
>   - name: Enable Scientific Linux 7 local repo
>     yum_repository:
>      name: Scientific_Linux_7_Local
>      description: Scientific_Linux_7-64
>      file: Scientific_linux
>      baseurl: http://berkrules/repos/sl7-64/
>      gpgcheck: no
>      when:
>        - ansible_distribution == 'Scientific'
>        - ansible_distribution_major_version == '7'
>
> Output - snipped
>
> PLAY [patch-test] 
> **************************************************************
>
> TASK [setup] 
> *******************************************************************
> ok: [XXTS2]
>
>
>
> TASK [debug] 
> *******************************************************************
> ok: [XXTS2] => {
>     "msg": "System XXXTS2 is Scientific major vession 7"
> }
>
>
> TASK [Enable Scientific Linux 6 x86 local repo] 
> ************************************
> fatal: [XXTS2]: FAILED! => {"changed": false, "failed": true, "msg": 
> "unsupported parameter for module: when"}
>
> NO MORE HOSTS LEFT 
> *************************************************************
>         to retry, use: --limit @....
>
>
> Many thanks for any help.
>
> Kane.
>

-- 
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/df635faf-e59b-4180-8688-9cdb73cc0dc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to