-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare.yml
38 lines (26 loc) · 953 Bytes
/
prepare.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
- hosts: all
remote_user: user
tasks:
- group: name=wheel
sudo: yes
- copy: src=files/etc/sudoers.d/wheel dest=/etc/sudoers.d/wheel
sudo: yes
- copy: content='{{hostname}}' dest=/etc/hostname
sudo: yes
- debug: var=ansible_all_ipv4_addresses
- template: src=templates/etc/hosts dest=/etc/hosts
sudo: yes
- user: name=daiad createhome=yes shell=/bin/bash groups=sudo,wheel append=yes
sudo: yes
- authorized_key: user=daiad key="{{lookup('file', '~/.ssh/id_rsa-daiad.pub')}}"
sudo: yes
- name: Reboot machine
command: shutdown -r now "Rebooting due to ansible updates"
sudo: yes
async: 0
poll: 0
ignore_errors: true
- name: Wait for host to reboot
local_action: wait_for host={{inventory_hostname}} state=started port=22 timeout=300
- name: Print a helloworld message
shell: echo 'Hello {{ansible_hostname}}, at ' $(date) >> ~/greeting-at-reboot.out.txt