-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yaml
134 lines (119 loc) · 3.51 KB
/
playbook.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
- name: Setup new VMs and install k3s
hosts: servers,agents
remote_user: root
become: yes
roles:
- role: setup_vm
vars:
eth_conn: eth0
dns_servers:
- 123.123.123.123
- role: partition_format
vars:
disk_device: /dev/sdb
mount_point: /data
- role: configure_docker
vars:
docker_username: FAKEUSER # replace accordingly
docker_password: FAKEPASSWORD # replace accordingly
docker_private_repo: private.abc.com
docker_rpm_tar_download: http://private.abc.com/docker-v24.0.6.tar
- role: install_k3s
vars:
k3s_repo_url: http://private.abc.com/k3s/v1.28.7
k3s_image_name: k3s-airgap-images-amd64.tar.gz
k3s_cluster_secret:
k3s_master_server_name: k3s-server-1
k3s_tls_san: 123.123.123.111,lb.abc.net
k3s_lb_url: lb.abc.net
k3s_selinux_rpm_path: http://private.abc.com/k3s-selinux-1.4-1.el7.noarch.rpm
private_docker_repo: private.abc.com
# - uninstall_k3s
- name: Set up k3s load balancer
hosts: load_balancers
remote_user: root
become: yes
roles:
- role: setup_vm
vars:
eth_conn: eth0
dns_servers:
- 123.123.123.123
- role: partition_format
vars:
disk_device: /dev/sdb
mount_point: /data
- role: configure_docker
vars:
docker_username: FAKEUSER # replace accordingly
docker_password: FAKEPASSWORD # replace accordingly
docker_private_repo: private.abc.com
docker_rpm_tar_download: http://private.abc.com/docker-v24.0.6.tar
- configure_k3s_lb
- name: Set up gitlab runner
hosts: gitlab_runners
remote_user: root
become: yes
roles:
- role: setup_vm
vars:
eth_conn: eth0
dns_servers:
- 123.123.123.123
- role: partition_format
vars:
disk_device: /dev/sdb
mount_point: /data
- role: configure_docker
vars:
docker_username: FAKEUSER # replace accordingly
docker_password: FAKEPASSWORD # replace accordingly
docker_private_repo: private.abc.com
docker_rpm_tar_download: http://private.abc.com/docker-v24.0.6.tar
- role: configure_gitlab_runner
vars:
data_directory: /data
- name: Install kube monitoring stack
hosts: servers
remote_user: root
become: yes
roles:
- role: install_monitoring_stack
vars:
helm_repo_url: http://private.abc.com/helm
helm_repo_download_path: http://private.abc.com/helm-v3.14.2-linux-amd64.tar.gz
- name: Set up couchbase
hosts: couchbase
remote_user: root
become: yes
roles:
- role: setup_vm
vars:
eth_conn: eth0
dns_servers:
- 123.123.123.123
- role: install_couchbase
vars:
couch_rpm_download_path: http://private.abc.com/rise-7.0.3-centos7.x86_64.rpm
- name: Create SSH keys
hosts: localhost
connection: local
tasks:
- name: Create SSH keys
openssh_keypair:
path: ~/.ssh/id_rsa_bdai
type: rsa
state: present
- name: Add key to SSH agent
shell: eval `ssh-agent` && ssh-add ~/.ssh/id_rsa_bdai
- name: Copy SSH keys to remote hosts
hosts: load_balancers, servers, agents, couchbase, gitlab_runners
remote_user: root
become: yes
tasks:
- name: Copy SSH keys
authorized_key:
user: root
state: present
key: "{{ lookup('file', '~/.ssh/id_rsa_bdai.pub') }}"