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
  config file = /etc/ansible/roles/xxxx/ansible.cfg
  configured module search path = Default w/o overrides

playbook - snipped

- hosts: patch-test

  - debug:
      msg: "System {{ inventory_hostname }} is {{ ansible_distribution }} 
major vession {{ ansible_distribution_major_version }}"
 - name: Enable Scientific Linux 6 x86 local repo
     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
     name: Scientific_Linux_7_Local
     description: Scientific_Linux_7-64
     file: Scientific_linux
     baseurl: http://berkrules/repos/sl7-64/
     gpgcheck: no
       - 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"}

        to retry, use: --limit @....

Many thanks for any help.


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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to