Native ansible filters and volumes handling #10

Merged
decentral1se merged 2 commits from volumes-handling into main 2021-01-06 11:06:55 +00:00
6 changed files with 30 additions and 12 deletions
Showing only changes of commit 5efff53088 - Show all commits

View File

@ -73,7 +73,10 @@
- name: Dump instance config - name: Dump instance config
copy: copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}" dest: "{{ molecule_instance_config }}"
when: server.changed | bool when: server.changed | bool
@ -83,5 +86,5 @@
host: "{{ item.address }}" host: "{{ item.address }}"
search_regex: SSH search_regex: SSH
delay: 10 delay: 10
with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" with_items: "{{ lookup('file', molecule_instance_config) | from_yaml }}"
{%- endraw %} {%- endraw %}

View File

@ -10,7 +10,7 @@
block: block:
- name: Populate instance config from file - name: Populate instance config from file
set_fact: set_fact:
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" instance_conf: "{{ lookup('file', molecule_instance_config) | from_yaml }}"
skip_instances: false skip_instances: false
rescue: rescue:
- name: Populate instance config when file missing - name: Populate instance config when file missing
@ -52,7 +52,10 @@
- name: Dump instance config - name: Dump instance config
copy: copy:
content: "{{ instance_conf | molecule_to_yaml | molecule_header }}" content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}" dest: "{{ molecule_instance_config }}"
when: server.changed | bool when: server.changed | bool
{%- endraw %} {%- endraw %}

View File

@ -74,7 +74,10 @@
- name: Dump instance config - name: Dump instance config
copy: copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}" dest: "{{ molecule_instance_config }}"
when: server.changed | bool when: server.changed | bool
@ -84,4 +87,4 @@
host: "{{ item.address }}" host: "{{ item.address }}"
search_regex: SSH search_regex: SSH
delay: 10 delay: 10
with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" with_items: "{{ lookup('file', molecule_instance_config) | from_yaml }}"

View File

@ -9,7 +9,7 @@
block: block:
- name: Populate instance config from file - name: Populate instance config from file
set_fact: set_fact:
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" instance_conf: "{{ lookup('file', molecule_instance_config) | from_yaml }}"
skip_instances: false skip_instances: false
rescue: rescue:
- name: Populate instance config when file missing - name: Populate instance config when file missing
@ -51,6 +51,9 @@
- name: Dump instance config - name: Dump instance config
copy: copy:
content: "{{ instance_conf | molecule_to_yaml | molecule_header }}" content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}" dest: "{{ molecule_instance_config }}"
when: server.changed | bool when: server.changed | bool

View File

@ -75,7 +75,10 @@
- name: Dump instance config - name: Dump instance config
copy: copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}" dest: "{{ molecule_instance_config }}"
when: server.changed | bool when: server.changed | bool
@ -85,4 +88,4 @@
host: "{{ item.address }}" host: "{{ item.address }}"
search_regex: SSH search_regex: SSH
delay: 10 delay: 10
with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" with_items: "{{ lookup('file', molecule_instance_config) | from_yaml }}"

View File

@ -9,7 +9,7 @@
block: block:
- name: Populate instance config from file - name: Populate instance config from file
set_fact: set_fact:
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" instance_conf: "{{ lookup('file', molecule_instance_config) | from_yaml }}"
skip_instances: false skip_instances: false
rescue: rescue:
- name: Populate instance config when file missing - name: Populate instance config when file missing
@ -52,6 +52,9 @@
- name: Dump instance config - name: Dump instance config
copy: copy:
content: "{{ instance_conf | molecule_to_yaml | molecule_header }}" content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}" dest: "{{ molecule_instance_config }}"
when: server.changed | bool when: server.changed | bool