add sudo_password

This commit is contained in:
Valentin CZERYBA 2022-10-20 16:47:03 +02:00
parent ad5dbdc914
commit a9c26d97bb
14 changed files with 216 additions and 23 deletions

View File

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

View File

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

View File

@ -1,13 +1,14 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
33613465613332313264333531363966386165643866306463363039613666343736633366666439 30326462626436373330386637633864316430623235306239353439313932383964646435393965
3962323963656131333937373932346536343861303936310a623331343034636330346438633232 3662326631306134363862626638616330633765666538360a323264646135393935343434343362
62393434623539376136616265623937326235636638343932363235353337643135373866363362 36666566316465383833386433623565373837353233366435346633313566623361653937306336
6237623238623536620a346463373363333965646132376330616166623065343961343166373563 6362383331643665300a393561643837376461326663663235343434363438623637306263626163
36316531623062313136383231366161363261633762616661663435393430346536356635313133 38336162383331383732643765323763656130653432386534376335336338663663363439666361
35636136336333623262653636323864313164623265313138373434643936323864366363643161 31306530666264323130333561356564626536643533356337383631613534383730666338313664
36323836363330346430653232356163663837366636653438316265303763646263303838346637 34626261616430623063323836616130383335383965326239636362616531623565323734613532
30646533386663363430623736393637356536663962346266626262373839323166313235643232 33313830663666633432666135346234643834316239633132383862393636623230316532616365
37393838633437383635323163326564646634626238393264653133386262656239396462333563 30336564306336393064613330336436363631316236353237343838396637353735356461323331
31363137396535643161633435643064643064653037363261303932366163373131663261666361 34343637336532373539663565666337383837373235613734303831376636303361376533346333
62613264353730343261613631303436346438646231643165373535353630353238393838633462 32316430613936366464383832376237633036353737353566613638396236316664356638373635
37613633666139326364 35303239353937316236323339633335373761623032313231383937306236303861306265646333
65633638623065303761646562373936336235373533333265643534616663343538

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 vps ansible_connection=ssh ansible_host=51.222.107.37 ansible_port=2424 ansible_user=valentin
localhost ansible_host=127.0.0.1
[db] [db]
vps vps
[db_vault:children] [db_vault:children]
db db
[local]
localhost
[local_vault:children]
local

View File

@ -2,4 +2,10 @@
- hosts: db - hosts: db
remote_user: valentin remote_user: valentin
roles: 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