-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DO NOT MERGE: Fix iptables persistence after reboot #373
base: master
Are you sure you want to change the base?
Conversation
Currently, etcd iptables rule doesn't persist after reboot. This is because we have to enable the iptables service. Otherwise, iptables service will not load after reboot
@@ -26,14 +27,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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be able to use ansible_os_family
instead
roles/etcd/tasks/main.yml
Outdated
@@ -1,3 +1,4 @@ | |||
[metacloud@mcp1 ansible]$ cat roles/etcd/tasks/main.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this ?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use service module instead
command: systemctl enable iptables | ||
|
||
- name: Start iptables service | ||
command: systemctl start iptables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use systemctl instead ... , but this may still work on older version of rhel
Currently, etcd iptables rule doesn't persist after reboot. This is
because we have to enable the iptables service. Otherwise, iptables
service will not load after reboot