{"repo":"Leif160519/ansible-linux","free":true,"listed":false,"github":"https://github.com/Leif160519/ansible-linux","clone":"git clone https://github.com/Leif160519/ansible-linux.git","description":"🎉使用ansible批量配置Linux，支持Debian和RedHat，包含常用软件的安装，系统配置等，支持自动化搭建prometheus监控，飞书告警，consul自动发现，loki日志采集等功能🎉","language":"Jinja","stars":57,"topics":["loki","vim","ssh","ansible","playbook","prometheus","ntp","zsh","fish","git"],"license":"GPL-3.0","category":"deployment-docker-iac","readme_excerpt":"一、说明 - Ansible官方文档 : [Ansible Documentation][1] - 本项目源自：[centos-script][2] [ubuntu-script][3] - 项目已通过安全扫描，清放心使用 二、项目介绍 - 使用到的特性：lineinfile,blockinfile,template,user,roles,package,apt,yum,service,systemd,handlers,notify等 - 推荐目标主机系统版本：Ubuntu 16.04,Centos 7,Debian 9 三、项目目录结构 四、如何使用 - 1.选择一台Linux或Mac主机安装python3并安装ansible - 2.将本机的ssh-key全部复制进所有目标主机中 - 3.克隆本项目 - 4.根据实际情况修改inventory下的主机hostname和IP地址 all: 所有机器,若目标主机ssh端口不为22,请在 ansible host 后新增一列 ansible port= os：根据系统版本进行分类 pro: 根据集群或者项目进行分类 - 5.ansible配置文件- ansible.cfg (使用pip3安装的ansible不会生成配置文件，可手动创建并配置，或者直接引用项目目录下的ansible.cfg(执行时会优先生效)) 使用代理进行ssh远程主机: 请将 127.0.0.1:3128 改为真实有效的代理地址 - 6.开始刷入(若使用代理上网，请添加参数 -e proxy url=\"http://example.com:3128\" ,支持http和socks5) 五、特定情况 - 1.安装某些软件 - 2.在某些机器上指定playbook - 3.监控主机安装prometheus 执行 prometheus.yml 之后别忘了执行一下 node exporter.yml ，否则 9090 不能显示监控数据 - 4.被监控主机安装node exporter 需在 node export.yml 文件中将 delegate to 后面的 prometheus 主机名按照实际情况修改之后再执行 - 5.安装node exporter时报错解决办法 在某些情况下，执行带有 delegate to （任务委派）的playbook时候，会报错： 原因是ansible未检测到python环境，也就是说你在Linux终端打 python 是提示无此命令的，所以解决办法是，强制ansible使用python3环境，在执行命令后面添加 -e ansible python interpreter=/usr/bin/python3 参数即可： 六、说明 - 1.prometheus安装完成后，默认加载了若干规则，详情请参看 files/prometheus/alert/rules/ - 2.项目中的部分文件已经配置了在vim下的自动折叠功能(依据标志),其他折叠方式如下： 在vim的配置文件中设置 set foldmethod=marker 或者通过ansible刷入即可： 七、补充内容 7.1 git代码统计工具 1) svn转化为git:git-svn - 安装： apt-get install git-svn - 下载svn库： git-svn clone - 更新svn库： git-svn rebase 2) git代码图形化报表：[gitstats][7];[gitinspector][8];git-bars - 安装： -","default_branch":null,"files":null,"tree":[],"storefront":"/r/Leif160519","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Leif160519/ansible-linux/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}