diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index c500ed3..4a9e58f 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -26,14 +26,20 @@ yum: pkg={{ item }} state=present with_items: - iptables-services - when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' + when: ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat' -- name: Install iptables-persistent +- name: Install iptables-persistent apt: name={{item}} state=installed with_items: - iptables-persistent when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' +- name: Enable iptables service + command: systemctl enable iptables + +- name: Start iptables service + command: systemctl start iptables + - name: setup iptables for etcd shell: > ( iptables -L INPUT | grep "{{ etcd_rule_comment }} ({{ item }})" ) || \ @@ -45,10 +51,10 @@ - "{{ etcd_peer_port1 }}" - "{{ etcd_peer_port2 }}" -# Save rules into /etc/sysconfig/iptables file for restoring rules on boot +# Save rules into /etc/sysconfig/iptables file for restoring rules on boot - name: Save iptables command: service iptables save - when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' + when: ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat' - name: copy the etcd start/stop script template: src=etcd.j2 dest=/usr/bin/etcd.sh mode=u=rwx,g=rx,o=rx @@ -58,4 +64,3 @@ - name: start etcd systemd: name=etcd daemon_reload=yes state=started enabled=yes -