-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.yml
45 lines (37 loc) · 1.7 KB
/
setup.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
- name: setup for develop enviroment with vagrant
hosts: all
sudo: yes
remote_user: vagrant
tasks:
# This should work too / #2372
# - name: Pushes user key to root's on vagrant boxes
# action: authorized_key key=$FILE($item) user=root
# first_available_file:
# - ~/.ssh/id_dsa.pub
# - ~/.ssh/id_rsa.pub
- name: Creates destination directory
# Workaround for #2372
file: state=directory mode=0700 dest=/root/.ssh/
- name: Pushes user's rsa key to root's vagrant box (it's ok if this TASK fails)
# action: authorized_key user=root key='$FILE(~/.ssh/id_rsa.pub)'
# Workaround for #2372
copy: src=~/.ssh/id_rsa.pub dest=/root/.ssh/authorized_keys owner=root mode=0600
register: rsa
ignore_errors: yes
- name: Pushes user's dsa key to root's vagrant box (it's NOT ok if both TASKs fail)
# action: authorized_key user=root key='$FILE(~/.ssh/id_dsa.pub)'
# Workaround for #2372
copy: src=~/.ssh/id_dsa.pub dest=/root/.ssh/authorized_keys owner=root mode=0600
when: rsa|failed
- name: Checks if resolver is working properly (issues with some VBox/Host OS combinations)
command: host -t A ansible.cc
register: ns
ignore_errors: yes
- name: Pushes new resolver configuration is resolver fails
lineinfile: regexp="^nameserver " line="nameserver 8.8.8.8" dest=/etc/resolv.conf
when: ns|failed
- name: Checks if resolver is working properly with new nameserver
command: host -t A ansible.cc
- name: Final greeting
pause: prompt="Don't worry about all the red above; if you made it here, your Vagrant VMs are probably fine !
Please press [Enter]"