-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision-playbook.yml
65 lines (57 loc) · 1.59 KB
/
provision-playbook.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
64
65
---
- hosts: all
gather_facts: false
vars:
use_python3: "{{ lookup('env', 'ANSIBLE_PYTHON_VERSION') != '2' }}"
roles:
- bbatsche.Base
- role: geerlingguy.swap
become: yes
when:
- ansible_connection | default('smart') != 'local'
- ansible_connection | default('smart') != 'docker'
pre_tasks:
- name: Install Python for Ansible
raw: >
bash -c "test -e /usr/bin/python{{ "3" if use_python3 else "" }} ||
(apt -qqy update && apt install -qqy python{{ "3" if use_python3 else "" }}-minimal)"
become: yes
register: output
changed_when:
- output.stdout != ""
- output.stdout != "\r\n"
- name: Gathering Facts
setup:
tasks:
- name: Always Expand Bash Aliases
copy:
content: shopt -s expand_aliases;
dest: /etc/profile.d/alias.sh
become: yes
- name: Accept All Environment Variables from SSH
lineinfile:
line: AcceptEnv *
regexp: ^AcceptEnv
dest: /etc/ssh/sshd_config
validate: /usr/sbin/sshd -t -f %s
become: yes
notify: Restart SSH
when:
- ansible_connection | default('smart') != 'local'
- ansible_connection | default('smart') != 'docker'
- name: Install Spec Dependencies
apt:
name:
- lsb-release
- lsb-core
- netcat
- net-tools
- iproute2
state: present
update_cache: yes
cache_valid_time: 86400
become: yes
handlers:
- name: Restart SSH
service: name=ssh state=restarted
become: yes