mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Provision with Teraform instead of Ansible
This commit is contained in:
parent
3f36885343
commit
9e83baffb3
9 changed files with 147 additions and 60 deletions
|
|
@ -1,50 +0,0 @@
|
|||
---
|
||||
- name: Adding authorized SSH keys
|
||||
scaleway_sshkey:
|
||||
ssh_pub_key: "{{ item }}"
|
||||
oauth_token: "{{ scw_token }}"
|
||||
state: present
|
||||
loop: "{{ scw_authorized_keys|flatten(levels=1) }}"
|
||||
|
||||
- name: Provision master nodes
|
||||
scaleway_compute:
|
||||
name: k8s-{{ k8s_scw_environment_short }}-master{{ item }}
|
||||
state: running
|
||||
image: ca9a9340-92e8-4c5f-8ae1-423466f7ef30
|
||||
organization: 4dcd777e-6ace-48ad-9f36-0b090880dcdb
|
||||
oauth_token: "{{ scw_token }}"
|
||||
region: ams1
|
||||
commercial_type: VC1S
|
||||
wait: true
|
||||
tags:
|
||||
- group:k8s
|
||||
- group:k8s_master
|
||||
- group:k8s_etcd
|
||||
- fact:index:{{ item }}
|
||||
- env:{{ k8s_scw_environment }}
|
||||
loop: "{{ range(1,k8s_scw_master_nodes_count+1)|list }}"
|
||||
|
||||
- name: Provision worker nodes
|
||||
scaleway_compute:
|
||||
name: k8s-{{ k8s_scw_environment_short }}-worker{{ item }}
|
||||
state: running
|
||||
image: ca9a9340-92e8-4c5f-8ae1-423466f7ef30
|
||||
organization: 4dcd777e-6ace-48ad-9f36-0b090880dcdb
|
||||
oauth_token: "{{ scw_token }}"
|
||||
region: ams1
|
||||
commercial_type: VC1S
|
||||
wait: true
|
||||
tags:
|
||||
- group:k8s
|
||||
- group:k8s_worker
|
||||
- fact:index:{{ item }}
|
||||
- env:{{ k8s_scw_environment }}
|
||||
loop: "{{ range(1,k8s_scw_worker_nodes_count+1)|list }}"
|
||||
|
||||
- name: Refresh inventory
|
||||
meta: refresh_inventory
|
||||
|
||||
- name: Add the instances to known hosts
|
||||
local_action: command sh -c 'ssh-keyscan -t rsa {{ hostvars[item].ansible_host }} >> $HOME/.ssh/known_hosts'
|
||||
with_items: "{{ groups['k8s'] }}"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue