-
Notifications
You must be signed in to change notification settings - Fork 2
/
base-setup.yml
64 lines (59 loc) · 1.64 KB
/
base-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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- name: install ansible requirements - ubuntu xenial
hosts: ubuntu[1..2]
gather_facts: false
tasks:
- name: install python2 (vagrant images seem to come with python3 only)
raw: apt update && apt install -y python python-apt
- name: install ansible requirements - ubuntu bionic
hosts: ubuntu[3..4]
gather_facts: false
tasks:
- name: install python3-apt
raw: apt install -y python3-apt
- name: install ansible requirements - freebsd
hosts: freebsd*
gather_facts: false
tasks:
- raw: pkg update && pkg install --yes python
- name: install ubuntu1 node as ansible control machine
hosts: ubuntu1
tasks:
- name: install pip
apt:
name:
- python3-pip
- name: install/upgrade Python tools
pip:
name:
- pip
- setuptools
extra_args: --upgrade
- name: install/upgrade ansible dependency
pip:
name:
- cryptography
extra_args: --upgrade
- name: install ansible
pip:
name: ansible
version: 2.5.2
- become_user: vagrant
name: checkout experiments repo on controller node
git:
dest: ./ansible-experiments
repo: https://github.com/stationgroup/ansible-experiments
- become_user: vagrant
name: create ssh key for vagrant user
user:
name: vagrant
generate_ssh_key: true
ssh_key_bits: 4096
ssh_key_file: .ssh/id_rsa
register: vagrant_control_user
- name: distribute vagrant@ubuntu1 ssh key
hosts: all
tasks:
- authorized_key:
key: '{{ hostvars.ubuntu1.vagrant_control_user.ssh_public_key }}'
user: vagrant