Thank You, Walter. It does work as expected however, I do have couple of variables inside the dirname.yml and different directories inside of the home path. The idea, I don't want to run the copy module (etc) in one execution but instead putting them in a group or set. Another purpose, I don't want them to restart them at the same time wherein it will be on schedule on when it will happen.
*dirname.yml* dir_list: - hello - goodbye - take-care *another_list:* - say - tell - make *exam_list:* - etc - other *Home Directory* - /home/hello-awssandbox001.us.com-123 - /home/goodbye-awssandbox001.us.com-123 - /home/takecare-awssandbox001.us.com-123 - /home/say-awssandbox001.us.com-123 - /home/tell-awssandbox001.us.com-123 - /home/make-awssandbox001.us.com-123 - /home/etc-awssandbox001.us.com-123 - /home/other-awssandbox001.us.com-123 Appreciated and thanks... WP On Thursday, August 4, 2022 at 10:53:41 AM UTC-5 [email protected] wrote: > See if this does what you want .. > > - name: Test Playbook Script for Debug > hosts: localhost > > vars_files: > - general_var.yml > - dirname.yml > - patch_file.yml > > tasks: > - name: Copy | All Mule v392 Patch to LIB-User Directory for > "{{Application_Runtime | upper}}" Runtime > copy: > src: "/user/lib/{{ item .0 }}" > > * dest: "/home/{{ item.1 }}-{{ ansible_hostname }}-{{ ver > }}/lib/user/"* > mode: 0644 > with_nested: > - "{{ patch_lib }}" > * - "{{ dir_list }}"* > > -- > Walter Rowe, Chief > Infrastructure Services > Office of Information Systems Management > National Institute of Standards and Technology > United States Department of Commerce > On Thursday, August 4, 2022 at 10:09:44 AM UTC-4 [email protected] wrote: > >> Yeah, I forgot to mention the result. >> Basically, there was no error but instead it creates a new directory from >> the value of 'app_name' rather than the item list of the dir_list. >> >> *Result:* /home/*dir_list*-awssandbox001.us.com-123/lib/user >> *Expected:* >> - /home/*hello*-awssandbox001.us.com-123/lib/user >> - /home/*goodbye*-awssandbox001.us.com-123/lib/user >> - /home/*take-care*-awssandbox001.us.com-123/lib/user >> >> Appreciated. >> >> Thanks, >> WP >> >> On Thursday, August 4, 2022 at 8:11:49 AM UTC-5 [email protected] wrote: >> >>> Are you getting an error? Can we see it? >>> -- >>> Walter Rowe, Chief >>> Infrastructure Services >>> Office of Information Systems Management >>> National Institute of Standards and Technology >>> United States Department of Commerce >>> >>> On Wednesday, August 3, 2022 at 5:02:16 PM UTC-4 [email protected] >>> wrote: >>> >>>> Hello Team, >>>> >>>> Can I ask some help on how to pull items as Extra-Vars? >>>> So, here is the scenario. >>>> >>>> *dirname.yml* >>>> dir_list: >>>> - hello >>>> - goodbye >>>> - take-care >>>> >>>> *patch_file.yml* >>>> patch_lib: >>>> - lib_1 >>>> - lib_2 >>>> >>>> *general_var.yml* >>>> main_dir: "{{ app_name }}-{{ ansible_hostname }}-{{ ver }}" >>>> >>>> *main_playbook.yml* >>>> - name: Test Playbook Script for Debug >>>> hosts: all >>>> >>>> vars_files: >>>> - general_var.yml >>>> - dirname.yml >>>> - patch_file.yml >>>> >>>> tasks: >>>> - name: Copy | All Mule v392 Patch to LIB-User Directory for >>>> "{{Application_Runtime | upper}}" Runtime >>>> copy: >>>> src: "/user/lib/{{ item .0 }}" >>>> dest: "/home/{{ item.1 }}/lib/user/" >>>> mode: 0644 >>>> with_nested: >>>> - "{{ patch_lib }}" >>>> - "{{ main_dir }}" >>>> >>>> And here's my playbook script that doesn't work. >>>> >>>> *ansible-playbook main_playbook.yml --limit awssandbox001.us.com >>>> <http://awssandbox001.us.com> -e "app_name= dir_list"* >>>> >>>> The idea, it should be able to copy the list of '*patch_lib*" into >>>> each "*main_dir*". >>>> dest: >>>> /home/hello-awssandbox001.us.com-123/lib/user >>>> /home/goodbye-awssandbox001.us.com-123/lib/user >>>> /home/take-care-awssandbox001.us.com-123/lib/user >>>> >>>> Look forward for anybody that can able to help. >>>> >>>> >>>> Thanks... WP >>>> >>> -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8e0aa7f6-6460-47e2-91bd-01d4e880d265n%40googlegroups.com.
