Skip to content

Commit b80e42d

Browse files
committed
Finished 'src/usage/playbook/using/filters.md'.
1 parent 12ff7d7 commit b80e42d

File tree

6 files changed

+433
-17
lines changed

6 files changed

+433
-17
lines changed

src/preface.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 前言
22

3-
Ansible 大约每年发布两次新的重要版本。核心应用程序的发展略显保守,以重视语言设计及设置的简洁性。贡献者可以更快地开发和更改模块和插件,并将其托管在专辑中。
3+
Ansible 大约每年发布两次新的重要版本。核心应用程序的发展略显保守,以重视语言设计及设置的简洁性。贡献者可以更快地开发和修改模组和插件,并将其托管在专辑中。
44

55
## Ansible 入门
66

@@ -49,7 +49,7 @@ Ansible 使用简单、人类可读的脚本(称为 playbook),来自动执
4949

5050
- **可扩展及灵活性,scalability and flexibility**
5151

52-
经由支持多种操作系统、云平台和网络设备的模块化设计,可轻松快速地扩展自动化系统。
52+
经由支持多种操作系统、云平台和网络设备的模组化设计,可轻松快速地扩展自动化系统。
5353

5454
- **幂等性和可预测性,idempotence and predictability**
5555

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
data:
3+
greeter.prefix: Hello
4+
kind: ConfigMap
5+
metadata:
6+
creationTimestamp: 2017-09-19T04:03:37Z
7+
name: spring-boot-configmaps-demo
8+
namespace: default
9+
resourceVersion: "50671"
10+
selfLink: /api/v1/namespaces/default/configmaps/spring-boot-configmaps-demo
11+
uid: 8397deb7-9cef-11e7-9b8d-080027da6995

src/usage/playbook/j2_example/playbook.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22
- name: Test filters
33
hosts: nginx
44
gather_facts: False
5-
vars:
6-
b64hector: "{{ '彭海林' | string | b64encode }}"
7-
string: "unisko@gmail.com"
85

96
tasks:
10-
- name: Gathering mounts
11-
setup:
12-
gather_subset:
13-
- distribution
14-
- mounts
15-
16-
- name: Get a comma-separated list of the mount points
17-
debug:
18-
# msg: "{{ '%Y-%m-%d %H:%M:%S' | strftime(ansible_date_time.epoch) }}"
19-
msg: "{{ '%H:%M:%S' | strftime(utc=True) }}"
7+
- name: "Human Readable"
8+
assert:
9+
that:
10+
- '"1.00 Bytes" == 1|human_readable'
11+
- '"1.00 bits" == 1|human_readable(isbits=True)'
12+
- '"10.00 KB" == 10240|human_readable'
13+
- '"97.66 MB" == 102400000|human_readable'
14+
- '"0.10 GB" == 102400000|human_readable(unit="G")'
15+
- '"0.10 Gb" == 10240000|human_readable(isbits=True, unit="G")'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
my_secret:
2+
kind: Secret
3+
metadata:
4+
name: my_secret_name
5+
6+
deployment_resource:
7+
kind: Deployment
8+
spec:
9+
template:
10+
spec:
11+
containers:
12+
- envFrom:
13+
- secretRef:
14+
name: {{ my_secret | kubernetes.core.k8s_config_resource_name }}

src/usage/playbook/using/filters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2330,7 +2330,7 @@ fatal: [debian_199]: FAILED! => {"msg": "Invalid value '11111111-2222-3333-4444-
23302330
# 获取某台主机上以逗号分隔的挂载点(例如 `"/,/mnt/stuff")列表
23312331
{{ ansible_mounts | map(attribute='mount') | join(',') }}
23322332
```
2333-
2333+
<a name="ansible_mounts"></a>
23342334
> **译注**`ansible_mounts` 这个变量,在执行 `ansible.builtin.setup``gather_subset` 任务后可用。
23352335
23362336

0 commit comments

Comments
 (0)