-
Notifications
You must be signed in to change notification settings - Fork 3
/
mailcow-start-server.yml
45 lines (40 loc) · 1.09 KB
/
mailcow-start-server.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
---
- name: Start Server
gather_facts: false
connection: local
hosts: 127.0.0.1
tasks:
- name: Install hcloud pip library
pip:
name: hcloud
state: present
- name: Generate SSH Key
openssh_keypair:
path: "{{ playbook_dir }}/id_ssh_rsa"
mode: 0600
force: yes
register: ssh_key_result
- name: Add SSH Key to hcloud
hetzner.hcloud.hcloud_ssh_key:
name: "{{ hcloud_server_name }}"
public_key: "{{ ssh_key_result.public_key }}"
api_token: "{{ vault__hcloud__token }}"
state: present
- name: Create mailcow integration test server
hetzner.hcloud.hcloud_server:
name: "{{ hcloud_server_name }}"
server_type: cx21
image: ubuntu-20.04
location: fsn1
ssh_keys:
- "{{ hcloud_server_name }}"
- servercow
- timo
state: present
api_token: "{{ vault__hcloud__token }}"
register: hcloud_created
- name: Create inventory template
template:
src: "{{ playbook_dir }}/templates/hostvars.yml.j2"
dest: "{{ playbook_dir }}/hostvars.yml"
no_log: yes