From 0646e20bc9b81435ed4eb550457528739f3e854f Mon Sep 17 00:00:00 2001 From: Elias Date: Fri, 9 Feb 2018 11:41:16 +0100 Subject: [PATCH] Playbook and documentation for config-multitenants with hobo-manage fix #21695 --- README.rst | 28 ++++++++++++++---- config-multitenants.yml | 12 ++++++++ inventory.yml | 8 ++++-- roles/config-multitenants/tasks/main.yml | 19 +++++++++++++ .../templates/hobo-manage-recipe-with-wcs.j2 | 33 ++++++++++++++++++++++ roles/config-multitenants/vars/main.yml | 2 ++ 6 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 config-multitenants.yml create mode 100644 roles/config-multitenants/tasks/main.yml create mode 100644 roles/config-multitenants/templates/hobo-manage-recipe-with-wcs.j2 create mode 100644 roles/config-multitenants/vars/main.yml diff --git a/README.rst b/README.rst index 7a2fcd7..f18cb7c 100644 --- a/README.rst +++ b/README.rst @@ -64,25 +64,41 @@ Usage ===== Install publik +-------------- +Remember, you need to be sudoer. .. code-block:: bash - ansible-playbook -i inventory.yml -K -e user=$(whoami) install.yml + ansible-playbook -i inventory.yml -K -e user=$(whoami) install.yml Install publik and skip theme compilation +----------------------------------------- .. code-block:: bash - ansible-playbook -i inventory.yml -K -e user=$(whoami) -e compile_theme=false install.yml + ansible-playbook -i inventory.yml -K -e user=$(whoami) -e compile_theme=false install.yml Send publik to the cemetery +--------------------------- .. code-block:: bash - ansible-playbook -i inventory.yml -K clean.yml + ansible-playbook -i inventory.yml -K clean.yml -Next -==== -Help yourself with your DNS settings and deploy some tenant applications using cook +Configure a basic multi-tenants publik cluster +------------------------------------------------- + +To set your DNS to handle all the domains registered in the +certificate {{ssl_certificate}} and in the Nginx configuration for publik : + +* edit /etc/hosts and ensure the line 127.0.0.1 has all the sub-domains required + +.. code-block:: bash + + 127.0.0.1 localhost hobo-hobo.local.publik agent-combo.local.publik user-combo.local.publik wcs-wcs.local.publik authentic-authentic.local.publik + +.. code-block:: bash + + ansible-playbook -i inventory.yml -K -e user=$(whoami) config-multitenants.yml diff --git a/config-multitenants.yml b/config-multitenants.yml new file mode 100644 index 0000000..bf8000a --- /dev/null +++ b/config-multitenants.yml @@ -0,0 +1,12 @@ +--- +- name: configuring publik multitenants for local developement + hosts: local + roles: + - config-multitenants + vars: + themes_dir: "{{venv}}/themes" + venv_bin: "{{venv}}/bin" + venv_conf: "{{venv}}/conf" + venv_pip: "{{venv_bin}}/pip" + venv_python: "{{venv_bin}}/python" + venv_share: "{{venv}}/share" diff --git a/inventory.yml b/inventory.yml index 57bc857..666f8a8 100644 --- a/inventory.yml +++ b/inventory.yml @@ -39,5 +39,9 @@ local: nginx_host_pattern: '~^(.*)\-wcs\.local\.publik$' project_name: wcs server_port: 8032 - - + hobo_base_dev_config: + authentic-authentic: "authentic-authentic.local.publik" + agent-combo: "agent-combo.local.publik" + user-combo: "user-combo.local.publik" + hobo-hobo: "hobo-hobo.local.publik" + wcs-wcs: "wcs-wcs.local.publik" diff --git a/roles/config-multitenants/tasks/main.yml b/roles/config-multitenants/tasks/main.yml new file mode 100644 index 0000000..5edd062 --- /dev/null +++ b/roles/config-multitenants/tasks/main.yml @@ -0,0 +1,19 @@ +- debug : + msg: | + "IF {{ hobo_base_dev_config['hobo-hobo'] }} is unreachable + (or any other sub-domain in inventory.yml hobo_base_dev_config) : + Refer to the README to set your DNS to handle the domains in the + development Nginx configuration" + +- name : copies a wcs skeleton archive + copy: + src: publik.zip + dest: "/var/lib/wcs/skeletons/{{wcs_skeleton_filename}}" + +- name: copies a cook json template + template: + src: templates/hobo-manage-recipe-with-wcs.j2 + dest: "{{wcs_dev_template_path}}" + +- name: Run command hobo-manage to initiate the development subdomains + command: "{{venv_bin}}/hobo-manage cook {{wcs_dev_template_path}} --timeout=600" diff --git a/roles/config-multitenants/templates/hobo-manage-recipe-with-wcs.j2 b/roles/config-multitenants/templates/hobo-manage-recipe-with-wcs.j2 new file mode 100644 index 0000000..f6736c8 --- /dev/null +++ b/roles/config-multitenants/templates/hobo-manage-recipe-with-wcs.j2 @@ -0,0 +1,33 @@ +{ + "steps": [ + {"create-hobo": { + "url": "https://{{hobo_base_dev_config['hobo-hobo']}}/" + }}, + {"create-authentic": { + "url": "https://{{hobo_base_dev_config['authentic-authentic']}}/", + "title": "Connexion" + }}, + {"set-idp": { + }}, + {"create-combo": { + "url": "https://{{hobo_base_dev_config['user-combo']}}/", + "title": "PortailUser", + "template_name": "portal-user" + }}, + {"create-combo": { + "url": "https://{{hobo_base_dev_config['agent-combo']}}/", + "title": "PortailAgent", + "slug": "portal-agent", + "template_name": "portal-agent" + }}, + {"create-wcs": { + "url": "https://{{hobo_base_dev_config['wcs-wcs']}}/", + "template_name": "publik.zip", + "slug": "services", + "title": "Démarches" + }}, + {"set-theme": { + "theme": "publik" + }} + ] +} diff --git a/roles/config-multitenants/vars/main.yml b/roles/config-multitenants/vars/main.yml new file mode 100644 index 0000000..5b81c30 --- /dev/null +++ b/roles/config-multitenants/vars/main.yml @@ -0,0 +1,2 @@ +wcs_dev_template_path: /tmp/hobo-manage-recipe-with-wcs.json +wcs_skeleton_filename: publik.zip -- 2.14.1