This repository has been archived by the owner on Aug 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy_jenkins.yml
117 lines (100 loc) · 3.22 KB
/
deploy_jenkins.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
# #####################################################################
# Deploy Jenkins
# #####################################################################
# #####################################################################
# Query some private ips
# #####################################################################
- hosts: tag_role_jumphost:&tag_user_{{ user }}
tasks:
- name: Get ipaddr of Jumphost
set_fact:
remote_ip: "{{ inventory_hostname | ipaddr}}"
- name: Get ipaddr of Jumphost
set_fact:
remote_ip: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
when: not remote_ip
- name: Store external ip address of Jumphost
add_host:
name: "{{ remote_ip }}"
groups: "moadsd_ng_jumphost_instance_public"
- hosts: localhost
gather_facts: false
tasks:
- name: Include vars
include: site_vars.yml
- name: Listing Jumphost Environment
debug:
msg:
- "Jumphost : {{ jumphost_ip }}"
when: site_deploy_jumphost == True
- name: Listing Kubernetes Environment
debug:
msg:
- "Kubernetes Master : {{ k8smaster_ip }}"
- "Kubernetes Worker 1 : {{ k8sworker1_ip }}"
when: site_deploy_kubernetes == True
- name: Listing OpenShift Environment
debug:
msg:
- "OpenShift Master : {{ openshift_ip }}"
when: site_deploy_openshift == True
- name: Listing Deep Security Environment
debug:
msg:
- "Deep Security : {{ dsm_ip }}"
- "PostgreSQL : {{ dsmdb_ip }}"
when:
- site_deploy_deepsecurity == True
- deepsecurity_variant == 'dsm'
# #####################################################################
# Deploy Jenkins
# #####################################################################
- name: Create and Configure Jumphost Proxy
hosts: tag_role_jumphost:&tag_user_{{ user }}
become: true
vars:
trusted_certificates: "{{ trusted_certificates }}"
create_proxy_configurations: True
tasks:
- name: Include vars
include: site_vars.yml
- name: Create Proxy instance
include_role:
name: proxy
vars:
operation: deploy
when: site_deploy_jumphost == True
- name: Create Proxy Configuration and Certificate for Jenkins
include_role:
name: proxy
vars:
operation: create_site
service_name: jenkins
jumphost_external_ip: "{{ inventory_hostname }}"
proxy_destination: "{{ k8smaster_ip }}"
node_port: "{{ jenkins_nodeport }}"
target_type: http
when:
- site_deploy_kubernetes == True
- site_deploy_jumphost == True
- name: Deploy Jenkins
hosts: tag_role_k8smaster:&tag_user_{{ user }}
become: true
tasks:
- name: Include vars
include: site_vars.yml
- name: Delete jenkins.*
become: true
become_user: ubuntu
file:
state: absent
path: "{{ item }}"
loop:
- ~/jenkins.txt
- ~/jenkins.log
- name: Deploy Jenkins
include_role:
name: jenkins
vars:
operation: deploy