From 7847a4ea1db8e71046b4868b42f39e80c36ec4a7 Mon Sep 17 00:00:00 2001 From: Emerson Rocha Luiz Date: Wed, 3 Jul 2019 21:13:30 -0300 Subject: [PATCH] =?UTF-8?q?mvp-1-no=20(EticaAI/aguia-pescadora#26):=20reor?= =?UTF-8?q?ganizado=20para=20potencialmente=20ter=20exemplo=20de=20mais=20?= =?UTF-8?q?de=20um=20n=C3=B3,=20mesmo=20sem=20kubernetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-node-tsuru-autossl.yml | 2 +- README.md | 55 ++++++++++++++++++- inventory/1-node-exemplo/inventory.ini | 5 +- inventory/3-node-example/inventory.yml | 1 + roles/paas-host/tasks/main.yml | 6 -- roles/tsuru-installer/tasks/main.yml | 6 ++ .../tasks/tsuru-install.yml | 0 .../tasks/tsuru-prepare-configs.yml | 42 +++++++------- .../templates/1-node}/install-compose.yml.j2 | 0 .../templates/1-node}/install-config.yml.j2 | 0 10 files changed, 86 insertions(+), 31 deletions(-) create mode 100644 inventory/3-node-example/inventory.yml rename roles/{paas-host => tsuru-installer}/tasks/tsuru-install.yml (100%) rename roles/{paas-host => tsuru-installer}/tasks/tsuru-prepare-configs.yml (57%) rename roles/{paas-host/templates/tsuru-initialization => tsuru-installer/templates/1-node}/install-compose.yml.j2 (100%) rename roles/{paas-host/templates/tsuru-initialization => tsuru-installer/templates/1-node}/install-config.yml.j2 (100%) diff --git a/1-node-tsuru-autossl.yml b/1-node-tsuru-autossl.yml index a1e67e3..e601860 100644 --- a/1-node-tsuru-autossl.yml +++ b/1-node-tsuru-autossl.yml @@ -17,7 +17,7 @@ - name: "localhost: tsuru client? docker? docker-machine?" hosts: localhost roles: - - can-localhost-setup-remote-tsuru + - tsuru-installer # - { role: 1-node-tsuru-autossl, tsuru_initialization_only: yes } - name: "Águia Pescadora PaaS Tudo-Em-Um-Nó (Tsuru PaaS, Minio, AutoSSL via OpenResty)" diff --git a/README.md b/README.md index 8bbe102..5f24571 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,15 @@ git clone https://github.com/EticaAI/aguia-pescadora-ansible-playbooks.git . ansible-playbook 1-node-tsuru-autossl.yml -e paas_host=example.com ``` + + > - Tsuru URLs: > - https://tsuru.example.com > - https://tsuru-dashboard.example.com @@ -49,7 +58,10 @@ ansible-playbook 1-node-tsuru-autossl.yml -e paas_host=example.com - [Seu computador local](#seu-computador-local) - [Instalação do Ansible](#instalação-do-ansible) - [Servidores remotos](#servidores-remotos) -- [Veja também](#veja-também) + - [Sobre este Ansible Playbook](#sobre-este-ansible-playbook) + - [Roles](#roles) + - [paas-host](#paas-host) + - [tsuru-installer](#tsuru-installer) - [Referências sobre a pilha de soluções da Águia Pescadora](#referências-sobre-a-pilha-de-soluções-da-águia-pescadora) - [Ansible](#ansible) - [Documentação Ansible-BR](#documentação-ansible-br) @@ -131,7 +143,46 @@ servidores remotos estarão com pacotes instalados e prontos para uso inicial**. - Caso opte por instalar com o 1-node.yml o `tsuru-client` requer que a chave privada usada no momento da instalação seja sem senha. -# Veja também +## Sobre este Ansible Playbook + +### Roles + + + +#### paas-host + +- [paas-host](roles/paas-host/README.md) + +`paas-host` é a função responsável por preparar a(s) VPSs para fazer +terminação TLS (isto é, servir o primeiro acesso HTTPS) que chegam no servidor. +Usa o [OpenResty](https://github.com/openresty/openresty) + +[GUI/lua-resty-auto-ssl](https://github.com/GUI/lua-resty-auto-ssl). + +#### tsuru-installer + +- [tsuru-installer](roles/tsuru-installer/README.md) + +Oferece uma versão mais limitada do que o fantástico +[Tsuru Installer](https://docs.tsuru.io/stable/installing/using-tsuru-installer.html) +automatizaria por você. + +A função dele é criar na pasta [tsuru-initialization-configs](tsuru-initialization-configs/) +os arquivos de configuração que são parâmetros usados na chamada +`tsuru install-create -c install-config.yml -e install-compose.yml`. Caso você +não tenha o [Docker](https://docs.docker.com/install/), +[Docker Machine](https://docs.docker.com/machine/install-machine/) e o +[Tsuru Client](https://tsuru-client.readthedocs.io/en/latest/installing.html) +irá alertar. + + ## Referências sobre a pilha de soluções da Águia Pescadora diff --git a/inventory/1-node-exemplo/inventory.ini b/inventory/1-node-exemplo/inventory.ini index 09a09cb..2e3db5a 100644 --- a/inventory/1-node-exemplo/inventory.ini +++ b/inventory/1-node-exemplo/inventory.ini @@ -1,2 +1,5 @@ [all] -aguia-pescadora-foxtrot.etica.ai \ No newline at end of file +aguia-pescadora-foxtrot.etica.ai + +[all:vars] +tsuru_cluster_name="aguia-pescadora-exemplo" diff --git a/inventory/3-node-example/inventory.yml b/inventory/3-node-example/inventory.yml new file mode 100644 index 0000000..9482051 --- /dev/null +++ b/inventory/3-node-example/inventory.yml @@ -0,0 +1 @@ +#... diff --git a/roles/paas-host/tasks/main.yml b/roles/paas-host/tasks/main.yml index 53a5a91..cd71375 100644 --- a/roles/paas-host/tasks/main.yml +++ b/roles/paas-host/tasks/main.yml @@ -16,9 +16,3 @@ - name: Requerimentos do Tsuru caso seja instalado diretamente na VPS include: tsuru-requeriments-if-direct-on-vps.yml - -- name: Prepara arquivos que serão usados pelo Tsuru para instalar na VPS remota (install-compose.yml e install-config.yml) - include: tsuru-prepare-configs.yml - -- name: Instalação do Tsuru - include: tsuru-install.yml diff --git a/roles/tsuru-installer/tasks/main.yml b/roles/tsuru-installer/tasks/main.yml index 44007b8..7101ec3 100644 --- a/roles/tsuru-installer/tasks/main.yml +++ b/roles/tsuru-installer/tasks/main.yml @@ -17,3 +17,9 @@ register: result3 changed_when: false ignore_errors: false + +- name: Prepara arquivos que serão usados pelo Tsuru para instalar na VPS remota (install-compose.yml e install-config.yml) + include: tsuru-prepare-configs.yml + +- name: Instalação do Tsuru + include: tsuru-install.yml diff --git a/roles/paas-host/tasks/tsuru-install.yml b/roles/tsuru-installer/tasks/tsuru-install.yml similarity index 100% rename from roles/paas-host/tasks/tsuru-install.yml rename to roles/tsuru-installer/tasks/tsuru-install.yml diff --git a/roles/paas-host/tasks/tsuru-prepare-configs.yml b/roles/tsuru-installer/tasks/tsuru-prepare-configs.yml similarity index 57% rename from roles/paas-host/tasks/tsuru-prepare-configs.yml rename to roles/tsuru-installer/tasks/tsuru-prepare-configs.yml index 4ffbb46..c889cb3 100644 --- a/roles/paas-host/tasks/tsuru-prepare-configs.yml +++ b/roles/tsuru-installer/tasks/tsuru-prepare-configs.yml @@ -13,39 +13,39 @@ - name: "tsuru-init: install-compose.yml 1" template: - src: roles/1-node-tsuru-autossl/templates/tsuru-initialization/install-compose.yml.j2 - dest: /install-compose.yml - owner: root - group: root - mode: '0600' + src: "{{role_path}}/templates/1-node/install-compose.yml.j2" + dest: "{{ playbook_dir }}/tsuru-initialization-configs/install-compose.yml" + #owner: root + #group: root + #mode: '0600' #variable_start_string: "{##" #variable_end_string: "##}" -- name: "tsuru-init: install-compose.yml 2" - fetch: - src: /install-compose.yml - dest: "{{ playbook_dir }}/tsuru-initialization-configs/" - #flat: yes +#- name: "tsuru-init: install-compose.yml 2" +# fetch: +# src: /install-compose.yml +# dest: "{{ playbook_dir }}/tsuru-initialization-configs/" +# flat: yes - name: "tsuru-init: install-config.yml 1" template: - src: roles/1-node-tsuru-autossl/templates/tsuru-initialization/install-config.yml.j2 - dest: /install-config.yml - owner: root - group: root - mode: '0600' + src: "{{role_path}}/templates/1-node/install-config.yml.j2" + dest: "{{ playbook_dir }}/tsuru-initialization-configs//install-config.yml" + #owner: root + #group: root + #mode: '0600' #variable_start_string: "{##" #variable_end_string: "##}" -- name: "tsuru-init: install-config.yml 2" - fetch: - src: /install-config.yml - dest: "{{ playbook_dir }}/tsuru-initialization-configs/" - #flat: yes +#- name: "tsuru-init: install-config.yml 2" +# fetch: +# src: /install-config.yml +# dest: "{{ playbook_dir }}/tsuru-initialization-configs/" +# flat: yes #- name: install-config.yml.j2(tsuru-init) # template: -# src: roles/1-node-tsuru-autossl/templates/tsuru-initialization/install-config.yml.j2 +# src: roles/tsuru-installertemplates/tsuru-initialization/install-config.yml.j2 # dest: /root/temp-tsuru-init/ # owner: root # group: root diff --git a/roles/paas-host/templates/tsuru-initialization/install-compose.yml.j2 b/roles/tsuru-installer/templates/1-node/install-compose.yml.j2 similarity index 100% rename from roles/paas-host/templates/tsuru-initialization/install-compose.yml.j2 rename to roles/tsuru-installer/templates/1-node/install-compose.yml.j2 diff --git a/roles/paas-host/templates/tsuru-initialization/install-config.yml.j2 b/roles/tsuru-installer/templates/1-node/install-config.yml.j2 similarity index 100% rename from roles/paas-host/templates/tsuru-initialization/install-config.yml.j2 rename to roles/tsuru-installer/templates/1-node/install-config.yml.j2