|
21 | 21 | - sni |
22 | 22 |
|
23 | 23 | - name: Module x509 | Manage Schema |
| 24 | + when: vars['icingaweb2_modules'][_module]['database']['import_schema'] | default(false) |
| 25 | + vars: |
| 26 | + _module: "{{ item.key }}" |
24 | 27 | block: |
25 | 28 | - name: Module x509 | Prepare _db informations |
26 | 29 | ansible.builtin.set_fact: |
|
36 | 39 | ssl_key: "{{ vars['icingaweb2_modules'][_module]['database']['ssl_key'] | default(omit) }}" |
37 | 40 | ssl_cipher: "{{ vars['icingaweb2_modules'][_module]['database']['ssl_cipher'] | default(omit) }}" |
38 | 41 | ssl_extra_options: "{{ vars['icingaweb2_modules'][_module]['database']['ssl_extra_options'] | default(omit) }}" |
39 | | - schema_path: /usr/share/icingaweb2/modules/x509/schema/mysql.schema.sql |
| 42 | + schema_path_mysql: /usr/share/icingaweb2/modules/x509/schema/mysql.schema.sql |
| 43 | + schema_path_pgsql: /usr/share/icingaweb2/modules/x509/schema/pgsql.schema.sql |
40 | 44 | select_query: "select * from x509_certificate" |
41 | | - when: vars['icingaweb2_modules'][_module]['database']['type'] | default('mysql') == 'mysql' |
| 45 | + type: "{{ vars['icingaweb2_modules'][_module]['database']['type'] | default(omit) }}" |
| 46 | + |
| 47 | + - ansible.builtin.fail: |
| 48 | + fail_msg: No database type was provided |
| 49 | + when: vars['icingaweb2_modules'][_module]['database']['type'] is not defined |
42 | 50 |
|
43 | 51 | - ansible.builtin.fail: |
44 | | - fail_msg: "The Database type select is not supported, {{ vars['icingaweb2_modules'][_module]['database']['type'] }} [Supported=mysql]" |
45 | | - when: vars['icingaweb2_modules'][_module]['database']['type'] is defined and vars['icingaweb2_modules'][_module]['database']['type'] != 'mysql' |
| 52 | + fail_msg: "Invalid database type was provided. [Supported: mysql, pgsql]" |
| 53 | + when: _db.type not in ['mysql', 'pgsql'] |
46 | 54 |
|
47 | | - - name: Module x509 | Import Schema |
| 55 | + - name: Module x509 | Import MySQL Schema |
48 | 56 | ansible.builtin.include_tasks: ../manage_mysql_imports.yml |
| 57 | + when: _db.type == 'mysql' |
| 58 | + |
| 59 | + - name: Module x509 | Import PostgresQL Schema |
| 60 | + ansible.builtin.include_tasks: ../manage_pgsql_imports.yml |
| 61 | + when: _db.type == 'pgsql' |
49 | 62 |
|
50 | 63 | - name: Module x509 | empty _db var |
51 | 64 | ansible.builtin.set_fact: |
52 | 65 | _db: {} |
53 | | - when: vars['icingaweb2_modules'][_module]['database']['import_schema'] | default(false) |
54 | | - vars: |
55 | | - _module: "{{ item.key }}" |
56 | 66 |
|
57 | 67 | - name: Module x509 | Import Certificates |
58 | 68 | ansible.builtin.shell: > |
|
0 commit comments