Hello All,

I think it could better. Basically, copy module is repeated based 
application and hostname the content changes
Could you please help me to reduce the number of lines in below tasks.

- 
  name: "Ensure file copied"
  copy: 
    content: "PRODUCTION-A2"
    dest: "{{alter_keystone_path}}/appname/environment.config"
    mode: 484
  when: "app_name == \"appname1\" and ansible_hostname == \"server01\" or 
ansible_hostname == \"server02\" or ansible_hostname == \"server03\""

- 
  name: "Ensure file copied"
  copy: 
    content: "PRODUCTION-A3"
    dest: "{{alter_keystone_path}}/appname/environment.config"
    mode: 484
  when: "app_name == \"appname1\" and ansible_hostname == \"server14\" or 
ansible_hostname == \"server15\" or ansible_hostname == \"server16\""

- 
  name: "Ensure file copied"
  copy: 
    content: "PRODUCTION-A5"
    dest: "{{alter_keystone_path}}/appname/environment.config"
    mode: 484
  when: "app_name == \"appname1\" and ansible_hostname == \"server17\" or 
ansible_hostname == \"server18\" or ansible_hostname == \"server19\""  
  
- 
  name: "Ensure file copied"
  copy: 
    content: "PRODUCTION-A8"
    dest: "{{alter_keystone_path}}/appname/environment.config"
    mode: 484
  when: "app_name == \"appname1\" and ansible_hostname == \"server10\" or 
ansible_hostname == \"server04\" or ansible_hostname == \"server05\""  


- 
  name: "Ensure file copied"
  copy: 
    content: "PRODUCTION-A10"
    dest: "{{alter_keystone_path}}/appname/environment.config"
    mode: 484
  when: "app_name == \"appname1\" and ansible_hostname == \"server06\" or 
ansible_hostname == \"server07\""

Thanks,
Balaji Chavdi 

-- 
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/3121a6d9-7042-4706-bc62-e175d544fefd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to