Skip to content

Commit c0e2541

Browse files
committed
big change
1 parent 9cc7c1f commit c0e2541

21 files changed

+35
-9
lines changed

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,22 @@ ansible-linux
1818
│   │   ├── config
1919
│   │   └── service
2020
│   ├── network
21+
│   ├── oh-my-zsh
2122
│   ├── prometheus
2223
│   │   ├── alert
2324
│   │   │   └── rules
2425
│   │   ├── exporter
2526
│   │   ├── scrape
2627
│   │   │   └── file_sd
2728
│   │   └── service
28-
│   └── repository
29+
│   ├── repository
30+
│   └── vim
31+
├── group_vars
32+
│   └── all
2933
├── inventory
3034
├── playbooks
31-
│   └── files -> ../files
35+
│   ├── files -> ../files
36+
│   └── group_vars -> ../group_vars
3237
└── roles
3338
├── ahuffman.resolv
3439
├── cloudalchemy.prometheus
@@ -78,7 +83,7 @@ private_key_file = /root/.ssh/id_rsa # 指定ansible用于ssh连接的私钥绝
7883
···
7984
8085
```
81-
- 6.开始刷入
86+
- 6.开始刷入(若使用代理上网,请修改`group_vars/all/proxy_env.yml`里的内容)
8287
```
8388
# all machine(prometheus.yml auto install node_exporter)
8489
ansible-playbook -u root -i inventory/ playbooks/universal.yml

group_vars/all/proxy_env.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
proxy_env:
3+
http_proxy: ""
4+
https_proxy: ""

playbooks/ccat.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# 默认配置用户为root,其他用户请-e username=ubuntu
33
- hosts: all
44
tags: ccat
5+
environment: "{{ proxy_env }}"
56
vars:
67
username: root
78
ccat_version: linux-amd64-1.1.0

playbooks/docker.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- name: 安装Docker
1010
hosts: all
1111
tags: [docker]
12+
environment: "{{ proxy_env }}"
1213
tasks:
1314
- name: 安装Docker和Docker-compose # {{{ | Debian
1415
apt:

playbooks/gitlab.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- name: 安装gitlab
1010
hosts: dist.centos7
1111
tags: [gitlab]
12+
environment: "{{ proxy_env }}"
1213
vars:
1314
gitlab_version: gitlab-ce-13.3.2-ce.0.el7.x86_64
1415
gitlab_url: https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/{{ gitlab_version }}.rpm

playbooks/grafana.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- name: 安装grafana
1010
hosts: all
1111
tags: [grafana]
12+
environment: "{{ proxy_env }}"
1213
vars:
1314
grafana_deb_version: grafana_7.3.1_amd64
1415
grafana_rpm_version: grafana-7.3.1-1.x86_64

playbooks/group_vars

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../group_vars

playbooks/loki.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- hosts: all
2+
environment: "{{ proxy_env }}"
23
vars:
34
loki_version: v1.6.1
45
promtail_version: v1.6.1

playbooks/mysql.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 安装Linux通用版mysql-5.7.28
22
- hosts: all
33
tags: mysql
4+
environment: "{{ proxy_env }}"
45
vars:
56
mysql_version: mysql-5.7.28-linux-glibc2.12-x86_64 # {{{ | 变量定义
67
mysql_root_dir: /var/lib/mysql

playbooks/network.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- name: 设置静态IP
1010
hosts: all
1111
tags: network
12+
environment: "{{ proxy_env }}"
1213
vars:
1314
dns1: 180.76.76.76
1415
dns2: 114.114.114.114

playbooks/nodejs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
- hosts: all
22
tags: nodejs
3+
environment: "{{ proxy_env }}"
34
tasks:
45
- name: 安装nodejs和npm
56
package:

playbooks/ntp.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- name: 设置ntp时间同步
1111
hosts: all
1212
tags: ntp
13+
environment: "{{ proxy_env }}"
1314
roles:
1415
- role: roles/geerlingguy.ntp
1516
ntp_enabled: true

playbooks/oh-my-fish.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- name: 安装oh-my-fish
1010
hosts: all
1111
tags: [fish]
12+
environment: "{{ proxy_env }}"
1213
tasks:
1314
- name: 安装fish包 # {{{
1415
package:

playbooks/oh-my-zsh.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- name: 安装oh-my-zsh
1111
hosts: all
1212
tags: [zsh]
13+
environment: "{{ proxy_env }}"
1314
vars:
1415
username: root
1516
tasks:

playbooks/prometheus.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
####
88
---
99
- hosts: all
10+
environment: "{{ proxy_env }}"
1011
vars:
1112
prometheus_root_dir: /opt/prometheus
1213
alertmanager_root_dir: /opt/alertmanager

playbooks/rar.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- name: 安装rar
1010
hosts: dist.centos
1111
tags: rar
12+
environment: "{{ proxy_env }}"
1213
vars:
1314
rar_version_x64: rarlinux-x64-5.7.1
1415
rar_version_x32: rarlinux-5.7.1

playbooks/repository.yml

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- name: Ubuntu LTS # {{{
1010
hosts: dist.ubuntu.lts
1111
tags: [ubuntu, lts]
12+
environment: "{{ proxy_env }}"
1213
vars:
1314
mirror: http://mirrors.aliyun.com/ubuntu/
1415
tasks:
@@ -23,6 +24,7 @@
2324
- name: Centos # {{{
2425
hosts: dist.centos
2526
tags: [centos]
27+
environment: "{{ proxy_env }}"
2628
tasks:
2729
- get_url:
2830
backup: yes
@@ -34,6 +36,7 @@
3436

3537
- name: RedHat # {{{ 参考:https://blog.csdn.net/yangZHyu/article/details/80565032
3638
hosts: dist.redhat:!dist.centos
39+
environment: "{{ proxy_env }}"
3740
vars:
3841
download_url: https://mirrors.aliyun.com/centos/7/os/x86_64/Packages
3942
yum_metadata_pparser_version: yum-metadata-parser-1.1.4-10.el7.x86_64
@@ -99,6 +102,7 @@
99102
- name: Debian # {{{
100103
hosts: dist.debian:!dist.ubuntu
101104
tags: debian
105+
environment: "{{ proxy_env }}"
102106
vars:
103107
mirror: http://mirrors.aliyun.com/debian/
104108
mirror_security: http://mirrors.aliyun.com/debian-security

playbooks/resolv.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
- hosts: all
55
tags: resolv
6+
environment: "{{ proxy_env }}"
67
roles:
78
- role: roles/ahuffman.resolv
89
resolv_nameservers:

playbooks/upgrade-git.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# 2020年10月30日
66
- hosts: dist.centos # {{{ | RedHat
77
tags: git
8+
environment: "{{ proxy_env }}"
89
vars:
910
git_version: git-2.29.2
1011
git_url: https://mirrors.edge.kernel.org/pub/software/scm/git/{{ git_version }}.tar.xz
@@ -77,6 +78,7 @@
7778

7879
- hosts: dist.ubuntu # {{{ | Ubuntu
7980
tags: git
81+
environment: "{{ proxy_env }}"
8082
tasks:
8183
- name: 安装依赖
8284
apt:

playbooks/vim-for-debian.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
- hosts: all
22
tags: vim
3+
environment: "{{ proxy_env }}"
34
vars:
45
username: root
56
vim_version: 8.1.2269
@@ -160,7 +161,6 @@
160161
set autoread
161162
set hlsearch
162163
set bg=dark
163-
set nowrap
164164
set number
165165
set ruler
166166
syntax on

playbooks/vim.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
- hosts: all
22
tags: vim
3+
environment: "{{ proxy_env }}"
34
vars:
45
username: root
56
tasks:
@@ -55,17 +56,13 @@
5556
dest: ~{{ username }}/.vim/plugged/vim-airline
5657
clone: yes
5758
update: yes
58-
owner: "{{ username }}"
59-
group: "{{ username }}"
6059
when: vim_airline.stat.exists == false
6160

6261
- git:
6362
repo: https://github.com/vim-airline/vim-airline-themes
6463
dest: ~{{ username }}/.vim/plugged/vim-airline-themes
6564
clone: yes
6665
update: yes
67-
owner: "{{ username }}"
68-
group: "{{ username }}"
6966
when: vim_airline_themes.stat.exists == false
7067
# }}}
7168

@@ -100,7 +97,6 @@
10097
set autoread
10198
set hlsearch
10299
set bg=dark
103-
set nowrap
104100
set number
105101
set ruler
106102
syntax on

0 commit comments

Comments
 (0)