Move concatenation of cluster preparation command to map.jinja
This commit is contained in:
@@ -20,3 +20,13 @@
|
|||||||
),
|
),
|
||||||
base='postgres',
|
base='postgres',
|
||||||
) %}
|
) %}
|
||||||
|
|
||||||
|
{# Concatenate the cluster preparation command and then append it to the `postgres` dict #}
|
||||||
|
{% set pc_cmd = '{0} {1}'.format(postgres.prepare_cluster.pgcommand, postgres.data_dir) %}
|
||||||
|
{% if postgres.cluster.locale %}
|
||||||
|
{% set pc_cmd = '{0} --locale={1}'.format(pc_cmd, postgres.cluster.locale) %}
|
||||||
|
{% endif %}
|
||||||
|
{% if postgres.cluster.encoding %}
|
||||||
|
{% set pc_cmd = '{0} --encoding={1}'.format(pc_cmd, postgres.cluster.encoding) %}
|
||||||
|
{% endif %}
|
||||||
|
{% do postgres.update({'prepare_cluster_cmd': pc_cmd}) %}
|
||||||
|
|||||||
@@ -76,14 +76,7 @@ postgresql-cluster-prepared:
|
|||||||
- name: {{ postgres.prepare_cluster.command }}
|
- name: {{ postgres.prepare_cluster.command }}
|
||||||
- unless: {{ postgres.prepare_cluster.test }}
|
- unless: {{ postgres.prepare_cluster.test }}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
{%- set cc_cmd = '{0} {1}'.format(postgres.prepare_cluster.pgcommand, postgres.data_dir) %}
|
- name: {{ postgres.prepare_cluster_cmd }}
|
||||||
{%- if postgres.cluster.locale %}
|
|
||||||
{%- set cc_cmd = '{0} --locale={1}'.format(cc_cmd, postgres.cluster.locale) %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- if postgres.cluster.encoding %}
|
|
||||||
{%- set cc_cmd = '{0} --encoding={1}'.format(cc_cmd, postgres.cluster.encoding) %}
|
|
||||||
{%- endif %}
|
|
||||||
- name: {{ cc_cmd }}
|
|
||||||
- unless: test -f {{ postgres.data_dir }}/{{ postgres.prepare_cluster.pgtestfile }}
|
- unless: test -f {{ postgres.data_dir }}/{{ postgres.prepare_cluster.pgtestfile }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
- cwd: /
|
- cwd: /
|
||||||
|
|||||||
Reference in New Issue
Block a user