# vim /etc/ansible/hosts[test]192.168.30.128
192.168.30.129
192.168.30.130
---- hosts: test remote_user: root
tasks:
- name: 关闭firewalld
service: name=firewalld state=stopped enabled=no
- name: 临时关闭 selinux shell: "setenforce 0"
failed_when: false
- name: 永久关闭 selinux lineinfile:
dest: /etc/selinux/config regexp: "^SELINUX="
line: "SELINUX=disabled"
- name: 添加EPEL仓库 yum: name=epel-release state=latest - name: 安装常用软件包 yum:
name:
- vim - lrzsz - net-tools - wget - curl - bash-completion - rsync - gcc - unzip - git state: latest - name: 更新系统 shell: "yum update -y"
args:
warn: False
# ansible-playbook prepare.yml