Take another pass at wiring up steps
This commit is contained in:
		| @ -1,30 +1,34 @@ | ||||
| --- | ||||
| - name: Setup preparatory facts | ||||
|   set_fact: | ||||
|     db_type: "{{ db['type'] }}" | ||||
|     mount_map: | ||||
|       mariadb: /var/lib/mysql | ||||
|  | ||||
| - name: "Create {{ db_type }} database" | ||||
|   no_log: true | ||||
|   shell: " | ||||
|     dokku | ||||
|     {{ db_type }}:create | ||||
|     {{ app }} | ||||
|     --password {{ db_passwd }} | ||||
|     --root-password {{ root_db_passwd }} | ||||
|   " | ||||
|   args: | ||||
|     creates: "/var/lib/dokku/services/{{ db_type }}/{{ app }}" | ||||
| - name: Run database setup tasks | ||||
|   when: db is defined | ||||
|   block: | ||||
|     - name: Setup preparatory facts | ||||
|       set_fact: | ||||
|         db_type: "{{ db.type }}" | ||||
|         mount_map: | ||||
|           mariadb: /var/lib/mysql | ||||
|  | ||||
| - name: Link mariadb database to application | ||||
|   dokku_service_link: | ||||
|     app: "{{ app }}" | ||||
|     name: "{{ app }}" | ||||
|     service: "{{ db_type }}" | ||||
|     - name: "Create {{ db_type }} database" | ||||
|       no_log: true | ||||
|       shell: " | ||||
|         dokku | ||||
|         {{ db_type }}:create | ||||
|         {{ app }} | ||||
|         --password {{ db_passwd }} | ||||
|         --root-password {{ root_db_passwd }} | ||||
|       " | ||||
|       args: | ||||
|         creates: "/var/lib/dokku/services/{{ db_type }}/{{ app }}" | ||||
|  | ||||
| - name: "Specify {{ db_type }} volume mounts" | ||||
|   dokku_storage: | ||||
|     app: "{{ app }}" | ||||
|     mounts: | ||||
|       - "/var/lib/dokku/services/{{ db_type }}/{{ app }}:{{ mount_map[db_type] }}" | ||||
|     - name: Link mariadb database to application | ||||
|       dokku_service_link: | ||||
|         app: "{{ app }}" | ||||
|         name: "{{ app }}" | ||||
|         service: "{{ db_type }}" | ||||
|  | ||||
|     - name: "Specify {{ db_type }} volume mounts" | ||||
|       dokku_storage: | ||||
|         app: "{{ app }}" | ||||
|         mounts: | ||||
|           - "/var/lib/dokku/services/{{ db_type }}/{{ app }}:{{ mount_map[db_type] }}" | ||||
|  | ||||
| @ -1,8 +1,23 @@ | ||||
| --- | ||||
| - name: "Configure {{ domain }} domain with Dokku" | ||||
| - name: "Configure {{ domain }} dedicated domain" | ||||
|   dokku_domains: | ||||
|     app: "{{ app }}" | ||||
|     domains: | ||||
|       - "{{ domain }}" | ||||
|     state: present | ||||
|   when: domain is defined | ||||
|  | ||||
| - name: Provide information on domain configuration | ||||
|   debug: | ||||
|     msg: | ||||
|       - "Dedicated domain discovered for the deployment of {{ app }}" | ||||
|       - "Your application will be available at https://{{ domain }}" | ||||
|   when: domain is defined | ||||
|  | ||||
| - name: Provide information on sub-domain configuration | ||||
|   debug: | ||||
|     msg: | ||||
|       - "No dedicated domain configured for the deployment of {{ app }}" | ||||
|       - "Dokku will provide a sub-domain configuration" | ||||
|       - "Your application will be available at https://{{ app }}.{{ dokku_hostname }}" | ||||
|   when: domain is not defined | ||||
|  | ||||
							
								
								
									
										9
									
								
								plays/lib/prepare.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								plays/lib/prepare.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| --- | ||||
| # Note(decentral1se): to avoid exploding when we import the config.yml from the | ||||
| # end-user, we spoof out variables that are referenced there but not populated | ||||
| # already (due to the order of the tasks we define for our deployment steps) | ||||
| - name: Export variable placeholders | ||||
|   set_fact: | ||||
|     dokku_db_addr: "" | ||||
|     dokku_db_user: "" | ||||
|     dokku_hostname: "{{ lookup('file', '/home/dokku/HOSTNAME') }}" | ||||
| @ -8,5 +8,5 @@ | ||||
|       - yaml | ||||
|   with_items: | ||||
|     - "{{ plugin_config_root }}" | ||||
|     # - "{{ app_config_root }}" | ||||
|     # - "{{ app_config_root }}/vault" | ||||
|     - "{{ app_config_root }}/vault" | ||||
|     - "{{ app_config_root }}" | ||||
|  | ||||
| @ -2,15 +2,22 @@ | ||||
| - hosts: all | ||||
|   gather_facts: false | ||||
|   tasks: | ||||
|     - name: Include vars tasks | ||||
|       include: ./lib/vars.yml | ||||
|     # Note(decentral1se): internal debugging. Please `debug: true` in the | ||||
|     # /var/lib/dokku/data/deploy.d/vars.yml file to activate a debug vars dump | ||||
|     - name: Include debug tasks | ||||
|       include: ./lib/debug.yml | ||||
|     # - name: Include http tasks | ||||
|     #   include: ./lib/http.yml | ||||
|     # - name: Include certs tasks | ||||
|     #   include: ./lib/certs.yml | ||||
|     # - name: Include proxy tasks | ||||
|     #   include: ./lib/proxy.yml | ||||
|     # - name: Include https tasks | ||||
|     #   include: ./lib/https.yml | ||||
|  | ||||
|     - name: Include vars tasks | ||||
|       include: ./lib/vars.yml | ||||
|  | ||||
|     - name: Include http tasks | ||||
|       include: ./lib/http.yml | ||||
|  | ||||
|     - name: Include certs tasks | ||||
|       include: ./lib/certs.yml | ||||
|  | ||||
|     - name: Include proxy tasks | ||||
|       include: ./lib/proxy.yml | ||||
|  | ||||
|     - name: Include https tasks | ||||
|       include: ./lib/https.yml | ||||
|  | ||||
| @ -2,11 +2,22 @@ | ||||
| - hosts: all | ||||
|   gather_facts: false | ||||
|   tasks: | ||||
|     - name: Include vars tasks | ||||
|       include: ./lib/vars.yml | ||||
|     # Note(decentral1se): internal debugging. Please `debug: true` in the | ||||
|     # /var/lib/dokku/data/deploy.d/vars.yml file to activate a debug vars dump | ||||
|     - name: Include debug tasks | ||||
|       include: ./lib/debug.yml | ||||
|     # - name: Include domain tasks | ||||
|     #   include: ./lib/domain.yml | ||||
|     # - name: Include env tasks | ||||
|     #   include: ./lib/env.yml | ||||
|  | ||||
|     - name: Include prepare tasks | ||||
|       include: ./lib/prepare.yml | ||||
|  | ||||
|     - name: Include vars tasks | ||||
|       include: ./lib/vars.yml | ||||
|  | ||||
|     - name: Include domain tasks | ||||
|       include: ./lib/domain.yml | ||||
|  | ||||
|     - name: Include database tasks | ||||
|       include: ./lib/db.yml | ||||
|  | ||||
|     - name: Include env tasks | ||||
|       include: ./lib/env.yml | ||||
|  | ||||
		Reference in New Issue
	
	Block a user