-
Notifications
You must be signed in to change notification settings - Fork 2
/
jenkins-docker-ubuntu-installation.yml
71 lines (60 loc) · 1.59 KB
/
jenkins-docker-ubuntu-installation.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
66
67
68
69
---
- name: Configure an API workstations
hosts: localhost
connection: local
gather_facts: no
become: yes
vars_prompt:
- name: 'reboot'
prompt: "You will need a reboot, do you want to reboot at the end of this script? (y/n)"
tasks:
- name: Install modules
pip:
name: "{{ item }}"
state: present
with_items:
- docker-py
- name: Install packages with apt
apt:
name: "{{ item }}"
state: latest
update_cache: yes
with_items:
- docker-engine
- name: Stop docker service
service:
name: docker
state: stopped
- name: Down ifconfig on docker0
ignore_errors: yes
shell: ifconfig docker0 down
- name: Delete docker0 ip link
ignore_errors: yes
shell: ip link del docker0
- name: Avoid conflicts between the Docker bridge and Corp IPs.
lineinfile:
dest: /etc/default/docker
line: 'DOCKER_OPTS="${DOCKER_OPTS} --bip=192.168.9.1/24"'
regexp: '^DOCKER_OPTS=.*'
state: present
- name: Avoid conflicts between the Docker bridge and Corp IPs.
lineinfile:
dest: /etc/default/docker
line: 'DOCKER_OPTS="${DOCKER_OPTS} --graph=/usr/local/google/docker"'
insertafter: '^DOCKER_OPTS="${DOCKER_OPTS} --bip=192.168.9.1/24"'
state: present
- name: Add current user to docker group
user:
name: "{{ ansible_user_id }}"
shell: /bin/bash
groups: docker
append: yes
- name: Start docker service
service:
name: docker
state: started
- name: Reboot node
shell: reboot now
async: 0
poll: 0
when: reboot == 'y'