deploy k8s

This commit is contained in:
Valentin CZERYBA 2022-10-08 19:13:45 +02:00
parent a844e10970
commit 0cef0d8c8a
14 changed files with 215 additions and 20 deletions

View File

@ -20,8 +20,10 @@
destination_port: 54321
jump: ACCEPT
state: present
become: yes
become_method: sudo
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Allow port redis
ansible.builtin.iptables:
@ -30,5 +32,7 @@
destination_port: 63791
jump: ACCEPT
state: present
become: yes
become_method: sudo
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"

View File

@ -7,9 +7,10 @@
destination_port: 54321
jump: ACCEPT
state: absent
become: yes
become_method: sudo
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Disallow port redis
ansible.builtin.iptables:
@ -18,8 +19,10 @@
destination_port: 63791
jump: ACCEPT
state: absent
become: yes
become_method: sudo
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Stopping existing service
community.docker.docker_compose:

View File

@ -1,10 +1,13 @@
$ANSIBLE_VAULT;1.1;AES256
35323139356565316333376432336436666566666631363635366235316435313536373765383234
6664623264396635643636663865626130616135326230610a373064656264323233663563623930
38373762363331663632343036336139663833616638653361363535643239643166363435613764
3864363664303836380a363739653638623639663262356532656262393862323164656531393531
35663166376632663734356666306433383363386236613330663536326432306561653665356533
64396538376432336532343366393938363963656432353638346165313836373136343433623435
65626138633637653631386663386462623633656434363761623366626565396362663864613166
33346136386532636132613532626133376534326339646161356461346434626335376661656534
32343936616335376563363131643938333833376231663862333961383566666137
37366162636533353362623830663666613437326438663465353862373865356235353034303934
6335626362343338656666313062323563656333366433330a613236613130303836356330306231
32353639396138386562316531633763346234303265663461636365366239356432643832343764
3735393031393436360a616539336639326561633139303439366465396365383161393739333566
65343464366431363533616232303931643833353064613562633231306336663530376335633933
33633464313539663566663762353432636332393734366336373730343834393430393035646566
35353663363963336364633530656366663266616164366237376161393266323231643130376663
38636433616334633933363131383462306131366264613032376339343634366134376334623166
30346131333865613064646137336161613030633133316665303838323836316666646531666338
30336131656365653162373339353762666534343734336666343965383031643132346436626535
39333865646266383230306635396336646264303930373931303331306632633162383363383237
64666566333035313536

View File

@ -0,0 +1 @@
project_terraform: /home/valentin/terraform

View File

@ -0,0 +1,10 @@
$ANSIBLE_VAULT;1.1;AES256
38396665356139383861356137373362393834373765663937373730333434356565383864333137
3763386361323938326462393632346565386432336531620a616261656133323236343464303837
39613966333435393336396361666337306438393138363961336462383666326363326439373762
6139623462323133330a646432336365666164643435383430616137313130646137623463373636
32313561383838366437633634376434616438633665363465626633633537383435616537336339
64313836613730613135363739363536356362373762313431353938653738613666313966393163
33336234363964633633663431353966666530353432643461656336356166393837316634313164
65653033636338363563666363326433636163323363656530323834303464356136346163353466
3533

View File

@ -1,7 +1,14 @@
vps ansible_connection=ssh ansible_host=51.222.107.37 ansible_port=2424 ansible_user=valentin
localhost ansible_host=127.0.0.1
[db]
vps
[db_vault:children]
db
db
[local]
localhost
[local_vault:children]
local

View File

@ -2,4 +2,10 @@
- hosts: db
remote_user: valentin
roles:
- db
- db
- hosts: local
remote_user: valentin
roles:
- scaleway-k8s
tags: ["create-cluster"]

29
scaleway-k8s/.travis.yml Normal file
View File

@ -0,0 +1,29 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

38
scaleway-k8s/README.md Normal file
View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for scaleway-k8s

View File

@ -0,0 +1,2 @@
---
# handlers file for scaleway-k8s

View File

@ -0,0 +1,52 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,36 @@
---
# tasks file for scaleway-k8s
- name: Create directory terraform
file:
path: /home/valentin/terraform
state: directory
- name: Copy main.tf
template:
src: main.tf.j2
dest: /home/valentin/terraform/main.tf
- name: Plan terraform
community.general.terraform:
project_path: '{{ project_terraform }}'
state: planned
register: output
environment:
SCW_ACCESS_KEY: "{{ scw_access_key }}"
SCW_SECRET_KEY: "{{ scw_secret_key }}"
- name: display plan terraform
debug:
var: output
- name: Create cluster scaleway
community.general.terraform:
project_path: '{{ project_terraform }}'
state: present
environment:
SCW_ACCESS_KEY: "{{ scw_access_key }}"
SCW_SECRET_KEY: "{{ scw_secret_key }}"

View File

@ -0,0 +1,2 @@
---
# vars file for scaleway-k8s