Skip to content

Commit 4ce63b3

Browse files
authored
docs(ansible): update example for ansible (#32)
1 parent d88b753 commit 4ce63b3

File tree

1 file changed

+55
-3
lines changed

1 file changed

+55
-3
lines changed

plugins/ansible/ansible/README.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,67 @@ docker run --rm \
1717
## 在 Coding-CI 上使用
1818

1919
```yml
20+
# .coding.yml
2021
master:
2122
push:
2223
- stages:
23-
- name: use
24+
- name: use ansible
2425
image: plugins/ansible
2526
settings:
2627
private_key: $PRIVATE_KEY
27-
playbook: deployment/playbook.yml
28-
inventory: deployment/hosts.yml
28+
inventory: hosts.conf
29+
playbook: playbook.yml
30+
```
31+
32+
```conf
33+
# hosts.conf
34+
[custom]
35+
127.0.0.1
36+
127.0.0.2
37+
127.0.0.3
38+
```
39+
40+
```yml
41+
# playbook.yml
42+
---
43+
- hosts:
44+
- custom
45+
remote_user: root
46+
vars:
47+
ansible_ssh_port: 36000
48+
tasks:
49+
50+
# 执行脚本
51+
- name: hello
52+
shell: echo hello
53+
54+
# 复制文件
55+
- name: copy
56+
copy:
57+
src: /dir/from/
58+
dest: /dir/to/
59+
owner: root
60+
group: root
61+
mode: 0644
62+
```
63+
64+
## 常见问题
65+
66+
### RSA 加密算法提示不支持时
67+
68+
建议使用 3.0 版本,即:`plugins/ansible:3`,示例如下
69+
70+
```yml
71+
# .coding.yml
72+
master:
73+
push:
74+
- stages:
75+
- name: use ansible
76+
image: plugins/ansible:3
77+
settings:
78+
private_key: $PRIVATE_KEY
79+
inventory: hosts.conf
80+
playbook: playbook.yml
2981
```
3082

3183
## 更多用法

0 commit comments

Comments
 (0)