-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path25_date_time_fourth.yml
39 lines (31 loc) · 1.1 KB
/
25_date_time_fourth.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
---
- name: "This code is going to give uptime"
hosts: localhost
tasks:
# This code is going to give uptime of current System
- name: "Check uptime of current redhat system"
ansible.builtin.command:
cmd: "uptime"
register: uptime_output
changed_when: false
- name: "Print"
ansible.builtin.debug:
var: uptime_output.stdout_lines
# # This will give the current System Date
# - name: "Show the Current system Time"
# ansible.builtin.command:
# cmd: date
# register: date_value
# changed_when: false
# - name: "Print"
# ansible.builtin.debug:
# var: date_value.stdout
- name: User Readable Date Time
ansible.builtin.debug:
msg:
- "{{ ansible_date_time.day }}-{{ ansible_date_time.month }}-{{ ansible_date_time.year }}, {{ ansible_date_time.weekday }} \
{{ ansible_date_time.time }} {{ ansible_date_time.tz }}"
- "--------------------"
- "{{ ansible_date_time }}"
- "--------------------"
- "{{ lookup('pipe', 'date +%d_%m_%Y_%H_%M_%S') }}"