host6,host5\targ3
host4,host3\targ1
host1,host2,host5\targ2
.....
.....
- name: Add hosts
add_host:
name: "{{ item.split('\t')[0] }}"
file_dets: "{{ item.split('\t')[1] }}"
ansible_host: localhost
ansible_connection: local
groups: dest_nodes
with_items: "{{ command_result.stdout_lines }}"
- hosts: dest_nodes
gather_facts: false
tasks:
- debug:
msg: Run the shell script with the arguments `{{ file_dets }}` here"--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ef6c8ef7-7462-4e05-8025-7d1f514329b7%40googlegroups.com.
- name: Add hosts
include_tasks: "{{ playbook_dir }}/gethosts.yml"
dest_ip: "{{ item.split('\t')[0] }}" groups: dest_nodes
file_dets: "{{ item.split('\t')[1] }}"
ansible_host: localhost
ansible_connection: local
with_items: "{{ command_result.stdout_lines }}"
add_host:
name: {{ item }}
with_items: "{{ dest_ip.split(',') }}"
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ef6c8ef7-7462-4e05-8025-7d1f514329b7%40googlegroups.com.
- name: "Play 1"
hosts: localhost
tasks:
- name: "Search DB"
command: > mysql --user=root --password=p@ssword deployment
--host=localhost -Ns -e "SELECT dest_ip,file_dets FROM deploy_dets WHERE num LIKE '{{ CR_Number }}'"
register: command_result - name: Add hosts
include_tasks: "{{ playbook_dir }}/gethosts.yml"
dest_ip: "{{ item.split('\t')[0] }}"
groups: dest_nodes
file_dets: "{{ item.split('\t')[1] }}"
ansible_host: localhost
ansible_connection: local
with_items: "{{ command_result.stdout_lines }}" add_host:
name: "{{ item }}"
with_items: "{{ dest_ip.split(',') }}"