--- - 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/d952e801-0edd-4cf7-823f-089fb2db158d%40googlegroups.com.