Michal Ptacek | 8913462 | 2018-12-19 12:10:34 +0000 | [diff] [blame] | 1 | --- |
| 2 | # DO NOT ADD SPACE AROUND ';' |
Tomáš Levora | 21c39f0 | 2019-04-05 11:25:01 +0200 | [diff] [blame] | 3 | - name: Start rancher server container |
Michal Ptacek | 8913462 | 2018-12-19 12:10:34 +0000 | [diff] [blame] | 4 | docker_container: |
Samuli Silvius | c580efe | 2019-03-17 18:06:33 +0200 | [diff] [blame] | 5 | name: rancher-server |
Tomáš Levora | 21c39f0 | 2019-04-05 11:25:01 +0200 | [diff] [blame] | 6 | image: "{{ rancher_server_image }}" |
Michal Ptacek | 8913462 | 2018-12-19 12:10:34 +0000 | [diff] [blame] | 7 | command: ["sh", "-c", "/usr/sbin/update-ca-certificates;/usr/bin/entry /usr/bin/s6-svscan /service"] |
| 8 | ports: 8080:8080 |
| 9 | state: started |
| 10 | restart_policy: unless-stopped |
| 11 | volumes: |
| 12 | - "{{ app_data_path }}/certs:/usr/local/share/ca-certificates/extra:ro" |
| 13 | |
| 14 | - name: Wait for rancher server to be ready |
| 15 | uri: |
| 16 | url: "{{ rancher_server_url }}/v2-beta" |
| 17 | register: response |
| 18 | retries: 10 |
| 19 | delay: 30 |
| 20 | until: not response.failed |
| 21 | |
Samuli Silvius | 673677a | 2019-03-17 19:28:33 +0200 | [diff] [blame] | 22 | - name: Create rancher kubernetes environment |
Michal Ptacek | 8913462 | 2018-12-19 12:10:34 +0000 | [diff] [blame] | 23 | rancher_k8s_environment: |
| 24 | name: "{{ app_name }}" |
| 25 | descr: "Kubernetes environment for {{ app_name }}" |
| 26 | server: "{{ rancher_server_url }}" |
| 27 | delete_other_k8s: "{{ rancher_remove_other_env }}" |
| 28 | force: "{{ rancher_redeploy_k8s_env }}" |
| 29 | host_os: "{{ ansible_os_family }}" |
| 30 | register: env |
| 31 | retries: 10 |
| 32 | delay: 5 |
| 33 | until: env.data is defined |
| 34 | |
| 35 | - name: Set apikey values |
| 36 | set_fact: |
| 37 | k8s_env_id: "{{ env.data.environment.id }}" |
| 38 | key_public: "{{ env.data.apikey.public }}" |
| 39 | key_private: "{{ env.data.apikey.private }}" |
| 40 | rancher_agent_image: "{{ env.data.registration_tokens.image }}" |
| 41 | rancher_agent_reg_url: "{{ env.data.registration_tokens.reg_url }}" |
Petr Ospalý | 2bfe0f9 | 2019-03-26 22:13:00 +0100 | [diff] [blame] | 42 | |
| 43 | - name: Configure the size of the rancher cattle db and logs |
| 44 | block: |
| 45 | - name: Main tables |
| 46 | rancher1_api: |
| 47 | server: "{{ rancher_server_url }}" |
Petr Ospalý | 9dee201 | 2019-04-05 09:57:03 +0200 | [diff] [blame^] | 48 | account_key: "{{ key_public }}:{{ key_private }}" |
| 49 | mode: settings |
| 50 | data: |
| 51 | option: main_tables.purge.after.seconds |
| 52 | value: "{{ rancher.main_tables_purge_after_seconds }}" |
Petr Ospalý | 2bfe0f9 | 2019-03-26 22:13:00 +0100 | [diff] [blame] | 53 | - name: Events |
| 54 | rancher1_api: |
| 55 | server: "{{ rancher_server_url }}" |
Petr Ospalý | 9dee201 | 2019-04-05 09:57:03 +0200 | [diff] [blame^] | 56 | account_key: "{{ key_public }}:{{ key_private }}" |
| 57 | mode: settings |
| 58 | data: |
| 59 | option: events.purge.after.seconds |
| 60 | value: "{{ rancher.events_purge_after_seconds }}" |
Petr Ospalý | 2bfe0f9 | 2019-03-26 22:13:00 +0100 | [diff] [blame] | 61 | - name: Service log |
| 62 | rancher1_api: |
| 63 | server: "{{ rancher_server_url }}" |
Petr Ospalý | 9dee201 | 2019-04-05 09:57:03 +0200 | [diff] [blame^] | 64 | account_key: "{{ key_public }}:{{ key_private }}" |
| 65 | mode: settings |
| 66 | data: |
| 67 | option: service_log.purge.after.seconds |
| 68 | value: "{{ rancher.service_log_purge_after_seconds }}" |
Petr Ospalý | 2bfe0f9 | 2019-03-26 22:13:00 +0100 | [diff] [blame] | 69 | - name: Audit log |
| 70 | rancher1_api: |
| 71 | server: "{{ rancher_server_url }}" |
Petr Ospalý | 9dee201 | 2019-04-05 09:57:03 +0200 | [diff] [blame^] | 72 | account_key: "{{ key_public }}:{{ key_private }}" |
| 73 | mode: settings |
| 74 | data: |
| 75 | option: audit_log.purge.after.seconds |
| 76 | value: "{{ rancher.audit_log_purge_after_seconds }}" |