Hello,

I am kinda new to Ansible, I would appreciate if you could assist me with a 
question, I am trying to do the following in a role in a playbook

1- Copy 3 zip files to a specific destination
2- Unzip only the first
3- Rename a directory in the unzipped location
4- Unzip the remaining 2 files

I mainly have 2 problems, the first is that only the first file is copied 
and second the when condition is apparently not written correctly

This is my list in the role's default directory
  installer_archives:
  - { name: V978971-01.zip, dest: "{{oracle_home_gi}}" }
  - { name: p28828717_180000_Linux-x86-64.zip, dest: "{{oracle_stage}}" }
  - { name: p6880880_121010_Linux-x86-64.zip, dest: "{{oracle_home_gi}}" }

This is my role:
# ==> Copy installer files
- name: Copy installer files
  copy:
    src: '{{ item }}'
    dest: '{{ oracle_stage }}/'
    owner: '{{ grid_install_user }}'
    mode: 0644
    group: '{{ oracle_group }}'
  with_items: '{{ installer_archives }}'
  when: ansible_hostname==groups[group_names | first] | first

- name: install-home-gi | Extract files to ORACLE_HOME (gi)
  unarchive:
    src: '{{ oracle_stage }}/{{ item }}'
    dest: '{{ item.dest }}'
    copy: no
    owner: '{{ grid_install_user }}'
    group: '{{ oracle_group }}'
  with_items: '{{installer_archives}}'
  args:
    creates: '{{ oracle_home_gi }}/root.sh'
  when: ansible_hostname==groups[group_names | first] | first and  
"{{installer_archives}}" | first

- name: install-home-gi | Move old Opatch directory
  shell: "mv {{ oracle_home_gi }}/OPatch {{ oracle_home_gi }}/OPatch.old"

- name: install-home-gi | Extract Opatch and BP
  unarchive:
    src: '{{ oracle_stage }}/{{ item.name }}'
    dest: '{{ item.dest }}'
    copy: no
    owner: '{{ grid_install_user }}'
    group: '{{ oracle_group }}'
  with_items: '{{installer_archives}}'
  when: ansible_hostname==groups[group_names | first] | first and not 
{{installer_archives}} | first

Thank you

-- 
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/0bcfd424-fc8e-4c9f-89a0-f1acf4cbd7ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to