ansible-playbook 安装配置zabbix iptables selinux ntp alipay源
来源:互联网 发布:淘宝新店铺怎么上货 编辑:程序博客网 时间:2024/06/03 18:01
执行方法:
[root@centos ansible]# pwd/etc/ansible[root@centos ansible]# ansible-playbook ansible-common.yml
任务目录结构:
[root@centos ansible]# tree roles/ansible-common/roles/ansible-common/├── files│ ├── zabbix-2.4.6.tar.gz│ └── zabbix_agentd_install.sh.tar.gz├── handlers│ └── main.yml├── tasks│ └── main.yml├── templates│ ├── iptables.j2│ └── ntp.conf.j2└── vars5 directories, 6 files
/etc/ansible/
[root@centos ansible]#ll
total 28
-rw-r--r--. 1 root root 8625 Oct 11 02:41 ansible.cfg
-rw-r--r--. 1 root root 68 Feb 15 16:41 ansible-common.yml
-rw-r--r--. 1 root root 60 Feb 14 09:36 findfile.yml
-rw-r--r--. 1 root root 1071 Feb 15 16:42 hosts
drwxr-xr-x. 6 root root 4096 Feb 15 16:38 roles
[root@centos ansible]#cat host[testhost]192.168.1.241[zabbixhost]192.168.1.241
[root@centos ansible]# cat ansible-common.yml - hosts: zabbixhost remote_user: root roles: - ansible-common
[root@centos ansible]# cat roles/ansible-common/tasks/main.yml ---#环境是centos6- name: alipay source configuration #shell: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo && yum makecache get_url: url=http://mirrors.aliyun.com/repo/Centos-6.repo dest=/etc/yum.repos.d/CentOS-Base.repo mode=0644 force=yes notify: - yum makecache- name: Install python bindings for SE Linux and NTP yum: name={{ item }} state=present with_items: - libselinux-python - libsemanage-python - ntp #- name: change hostname# shell: sed -i 's/HOSTNAME=.*/HOSTNAME={{ ansible_all_ipv4_addresses[0] }}/g' /etc/sysconfig/network# when: ansible_all_ipv4_addresses[0] == "192.168.1.241"- name: test to see if selinux is running command: getenforce register: sestatus changed_when: false- name: Configure ntp file template: src=ntp.conf.j2 dest=/etc/ntp.conf tags: ntp notify: restart ntp- name: Start the ntp service service: name=ntpd state=started enabled=yes tags: ntp- name: Copy zabbix client files to zabbixhost copy: src=zabbix-2.4.6.tar.gz dest=/root/zabbix-2.4.6.tar.gz mode=0644- name: Copy Zabbix install Script tar.gz to zabbixhost copy: src=zabbix_agentd_install.sh.tar.gz dest=/root/zabbix_agentd_install.sh.tar.gz mode=644 #notify: # Extract zabbix install script #- zabbix install-script- name: extract zabbix install script unarchive: src=/root/zabbix_agentd_install.sh.tar.gz dest=/root copy=no mode=755 tags: zabbix install notify: zabbix install script - name: zabbixhost client iptables configuration template: src=iptables.j2 dest=/etc/sysconfig/iptables notify: restart iptables tags: iptables configurate
项目文件:http://pan.baidu.com/s/1sjWfIRN
0 0
- ansible-playbook 安装配置zabbix iptables selinux ntp alipay源
- ansible安装配置zabbix客户端
- 集群运维自动化工具ansible之使用playbook安装zabbix客户端
- Ansible playbook简介与配置
- ansible使用playbook安装nginx
- Ansible playbook
- ansible-playbook
- ansible playbook
- ansible playbook
- ansible-playbook实战之批量安装mysql
- ansible-playbook实战之批量安装lamp
- hadoop安装和维护04--NTP服务器,SELinux,防火墙配置
- centos7 关闭firewall安装iptables并配置,关闭SELINUX
- ansible playbook最佳实践
- ansible-playbook简介
- Ansible Playbook 介绍
- ansible之playbook入门
- Ansible playbook简单示例
- Eclipse/myeclipse中为SVN设置快捷键
- ListView侧滑删除
- java中如何使用自己创建的异常
- 把jason字符串转化为标注的data(responseObject)类型
- cocos2d-x sdk接入库文件拷贝问题
- ansible-playbook 安装配置zabbix iptables selinux ntp alipay源
- usaco skidesign
- (疯狂的Android讲义 学习笔记)android数据存储
- usaco sort3
- 2015年总结和2016年计划
- 学习链接
- 不用new的方式手动构造JS对象
- Shell 数组简介
- 设计模式之单例模式