Ansible随记:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第21行: | 第21行: | ||
https://my.oschina.net/ozakilsc/blog/693023 | https://my.oschina.net/ozakilsc/blog/693023 | ||
<br /> | <br /> | ||
====shell==== | ====shell==== | ||
第28行: | 第29行: | ||
ansible k8s -m shell -a "iptables -F && iptables -X && iptables -F -t nat && iptables -t nat -X && iptables -t raw -F && iptables -t raw -X && iptables -t mangle -F && iptables -t mangle -X"<br /> | ansible k8s -m shell -a "iptables -F && iptables -X && iptables -F -t nat && iptables -t nat -X && iptables -t raw -F && iptables -t raw -X && iptables -t mangle -F && iptables -t mangle -X"<br /> | ||
====ping==== | ====ping==== | ||
第34行: | 第36行: | ||
ansible k8s -m ping | ansible k8s -m ping | ||
<br /> | <br /> | ||
====command==== | ====command==== | ||
(ansible default module) | (ansible default module) | ||
<br /> | |||
<br /> | <br /> | ||
第52行: | 第57行: | ||
ansible k8s -m yum -a 'name=vsftpd state=removed' | ansible k8s -m yum -a 'name=vsftpd state=removed' | ||
<br /> | |||
<br /> | <br /> | ||
第63行: | 第70行: | ||
ansible k8s -km service -a "name=postfix state=stopped enabled=no" | ansible k8s -km service -a "name=postfix state=stopped enabled=no" | ||
==== copy ==== | |||
ansible k8s -m copy -a "src=./kubernetes.conf dest=/etc//sysctl.d/" | |||
2020年3月29日 (日) 16:33的版本
For linux
hosts
[k8s] k8s-node-1 ansible_ssh_host=172.16.139.102 k8s-node-2 ansible_ssh_host=172.16.139.103 k8s-node-3 ansible_ssh_host=172.16.139.104 [test] 192.168.1.250 ansible_ssh_port=1234 192.168.1.251 ansible_ssh_user=xxx ansible_ssh_pass=yyy
module
selinux
ansible k8s -m selinux -m selinux -a state=disabled
https://my.oschina.net/ozakilsc/blog/693023
shell
ansible k8s -m shell -a getenforce
ansible k8s -m shell -a hostname
ansible k8s -m shell -a "iptables -F && iptables -X && iptables -F -t nat && iptables -t nat -X && iptables -t raw -F && iptables -t raw -X && iptables -t mangle -F && iptables -t mangle -X"
ping
(用于判断远程客户端是否在线)
ansible k8s -m ping
command
(ansible default module)
yum
(default state:installed)
ansible k8s -m yum -a 'name=vim state=installed'
ansible k8s -m yum -a 'name=vim'
ansible k8s -m yum -a 'name=vim, httpd'
ansible k8s -km yum -a "name=yum-utils,chrony,conntrack,ipvsadm,ipset,jq,iptables,curl,sysstat,libseccomp,wget,socat,git"
ansible k8s -m yum -a 'name=vsftpd state=removed'
service
ansible k8s -m service -a " name='nginx' enabled=yes"
ansible k8s -m service -a "name=httpd state=started"
ansible k8s -m service -a "name=firewalld state=stopped enabled=no"
ansible k8s -km service -a "name=postfix state=stopped enabled=no"
copy
ansible k8s -m copy -a "src=./kubernetes.conf dest=/etc//sysctl.d/"
others
ansible k8s -m shell -a "rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"