-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yml
59 lines (48 loc) · 1.57 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
- name: Connect to a remote host and run commands
hosts: my_host
tasks:
- name: List directory contents with ls
shell: ls
register: ls_output
- name: Display the output of ls
debug:
msg: "{{ ls_output.stdout }}"
- name: Check disk space usage with df
shell: df -h
register: df_output
- name: Display the output of df
debug:
msg: "{{ df_output.stdout }}"
- name: Get JSON data from command
command: "curl -s https://jsonplaceholder.typicode.com/todos/1"
register: json_output
- name: Parse JSON and access properties
vars:
parsed_json: "{{ json_output.stdout | from_json }}"
debug:
msg: "The property value is {{ parsed_json['title'] }}"
---
- name: Run commands on the local host
hosts: local
tasks:
- name: List directory contents with ls
shell: ls
register: ls_output
- name: Display the output of ls
debug:
msg: "{{ ls_output.stdout }}"
- name: Check disk space usage with df
shell: df -h
register: df_output
- name: Display the output of df
debug:
msg: "{{ df_output.stdout }}"
- name: Get JSON data from command
command: "curl -s https://jsonplaceholder.typicode.com/todos/1"
register: json_output
- name: Parse JSON and access properties
vars:
parsed_json: "{{ json_output.stdout | from_json }}"
debug:
msg: "The property value is {{ parsed_json['title'] }}"