blob: ad1293d5f5d83f20dd4eac335d83323c6b497f7a [file] [log] [blame]
---
# tasks file for apigee-shutdown-iptables
- name: Stop Iptables service
service:
name: iptables
state: stopped
when: (ansible_distribution | lower == "centos" or ansible_distribution | lower == "oraclelinux") and ansible_distribution_major_version | version_compare("6", "==") and not ansible_virtualization_type | lower == "docker"
register: iptables_status
- name: Fail playbook if Iptables is running
debug:
msg: 'iptables must be disabled, please restart node'
when: "{{ iptables_status is defined and iptables_status.state is defined and iptables_status.state!= 'stopped' }}"
- name: Restarting node now
become: true
ignore_errors: yes
shell: 'reboot now'
when: "{{ ansible_selinux.status | lower != 'disabled' }}"
async: 0
poll: 0
when: "{{ iptables_status is defined and iptables_status.state is defined and iptables_status.state!= 'stopped' }}"
- name: Waiting for server to complete reboot cycle
local_action: wait_for port='{{ ansible_port }}' state=started