-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathansible-resize2m1.yml
41 lines (31 loc) · 1.04 KB
/
ansible-resize2m1.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
---
- name: list OpenStack servers
hosts: os_agent
tasks:
# Playbook run delimiter with current timestamp
- name: local - Get timestamp from the system
shell: "date +%Y-%m-%d%H-%M-%S"
register: tstamp
- name: local - Set timestamp variable
set_fact:
cur_time: "{{ tstamp.stdout[10:]}}"
- name: local - print timestamp to the log file
local_action:
module: copy
content: ">>> Time: {{ cur_time }} ==================\n"
dest: /home/xubuntu/clamp/log/log.txt
- name: remote - write delimiter to the log file
lineinfile:
dest: /home/xubuntu/clamp/logs/log.txt
# create: yes
insertafter: EOF
line: "\n>>> Time: {{ cur_time }} >>>>>>>>>>>>>>>>>>>>>"
# Log from running Nowa script itself
- name: remote - run the script stored on the remote server
shell: /home/xubuntu/clamp/resize2m1.sh >> log.txt
args:
chdir: /home/xubuntu/clamp/logs/
executable: /bin/bash
# ansible.builtin.shell:
# shell: echo "Hello!"
# script: sh /home/xubuntu/clamp/test.sh