The following Result:- TASK [debug] ******************************************************************* task path: /etc/ansible/playbooks/test.yaml:59 ok: [127.0.0.1] => { "hostvars[groups['msliv'][0]]['downgraderpmversion']['stdout']": "5.42.0-201809042105.733e1aa" }
TASK [shell] ******************************************************************* task path: /etc/ansible/playbooks/test.yaml:61 changed: [127.0.0.1] => {"changed": true, "cmd": "echo hostvars[groups['msliv'][0]]['downgraderpmversion']['stdout']", "delta": "0:00:01.219563", "end": "2019-07-30 14:14:25.187306", "rc": 0, "start": "2019-07-30 14:14:23.967743", "stderr": "", "stderr_lines": [], "stdout": "hostvars[groups[msliv][0]][downgraderpmversion][stdout]", "stdout_lines": ["hostvars[groups[msliv][0]][downgraderpmversion][stdout]"]} On Tuesday, July 30, 2019 at 7:42:54 PM UTC+5:30, Kunalsing Thakur wrote: > > --- > - name: RollBack Rpm versions for {{ service_name }} > hosts: local > connection: local > gather_facts: false > tasks: > - name: Getting host list from ipa > shell: /etc/ansible/playbooks/hostfind.sh > - name: Creating in memory inventory group for {{ nodetype }} in > ansible playbook itself > shell: cat /etc/ansible/hosts | grep {{ nodetype }} | grep {{ env }} > register: host_list > - add_host: > name: "{{ item }}" > group: "{{ nodetype }}" > with_items: "{{ host_list.stdout_lines }}" > > - name: Rollback Execution start on {{ nodetype }} > hosts: "{{ nodetype }}" > connection: ssh > gather_facts: false > any_errors_fatal: false > user: test > become: yes > serial: 1 > tasks: > - name: Rolling back service on {{ inventory_hostname }} > block: > - name: Downgrading Rpm {{ service_name }} > shell: yum downgrade "{{ service_name }}" -y > - name: Getting Version of {{ service_name }} in {{ > inventory_hostname }} > shell: rpm --queryformat "%{VERSION}-%{RELEASE}" -q "{{ > service_name }}" > register: downgraderpmversion > - name: Restarting {{ service_name }} service on {{ > inventory_hostname }} > include_tasks: > /etc/ansible/inventories/playbooks/common/service_restart.yaml > with_items: > - { servicename: '{{ service_name }}' } > - name: wait for 60 second to come up the service {{ service_name > }} on {{ inventory_hostname }} > wait_for: > port: "{{ port_num }}" > host: '{{ inventory_hostname }}' > > - name: Updating Rpm versions for {{ service_name }} > hosts: local > connection: local > gather_facts: false > tasks: > - debug: > var: hostvars[groups['{{ nodetype > }}'][0]]['downgraderpmversion']['stdout'] > - shell: echo hostvars[groups['{{ nodetype > }}'][0]]['downgraderpmversion']['stdout'] > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1248cc9b-9401-4a21-9bfc-26126415cd1f%40googlegroups.com.