Skip to content

Commit

Permalink
Merge pull request #12 from dcos/julferts/script_content
Browse files Browse the repository at this point in the history
workaround multi-line issue with _contents in dcos-config
  • Loading branch information
fatz authored Mar 12, 2019
2 parents 9f339bd + 2964224 commit 220f0d7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion roles/DCOS.bootstrap/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bootstrap_port: 8080
s3_prefix: "ansible-dcos-exhibitor"

customer_key: "00000000-0000-0000-0000-000000000000"

dcos_config: {}
ip_detect: eth0
resolvers: |
- 8.8.4.4
Expand Down
34 changes: 34 additions & 0 deletions roles/DCOS.bootstrap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,40 @@
when: "dcos.config.fault_domain_detect_contents is not defined"
notify: trigger_new_config

# vvv FIXME: workaround for bad multi-line handling in DC/OS config vvv

- name: "Generate IP detection script from ip_detect_contents"
copy:
dest: "{{ download_path }}/genconf/ip-detect"
mode: 0644
content: "{{ dcos.config.ip_detect_contents }}"
when: "dcos.config.ip_detect_contents is defined"
notify: trigger_new_config

- name: "Generate IP detection script from ip_detect_public_contents"
copy:
dest: "{{ download_path }}/genconf/ip-detect-public"
mode: 0644
content: "{{ dcos.config.ip_detect_public_contents }}"
when: "dcos.config.ip_detect_public_contents is defined"
notify: trigger_new_config

- name: "Generate IP detection script from fault_domain_detect_contents"
copy:
dest: "{{ download_path }}/genconf/fault-domain-detect"
mode: 0644
content: "{{ dcos.config.fault_domain_detect_contents }}"
when: "dcos.config.fault_domain_detect_contents is defined"
notify: trigger_new_config

# vvv filter and generate config vvv

- name: Filter Config. Get rid of ip_detect_contents,ip_detect_contents and fault_domain_detect_contents
set_fact:
dcos_config: "{{ dcos_config | combine({item.key: item.value}) }}"
when: "item.key not in ['ip_detect_contents','ip_detect_public_contents','fault_domain_detect_contents']"
with_dict: "{{ dcos['config'] }}"

- name: Generate DC/OS configuration
template:
src: "config.yaml.j2"
Expand Down
2 changes: 1 addition & 1 deletion roles/DCOS.bootstrap/templates/config.yaml.j2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ dcos['config'] | combine({'bootstrap_url': dcos['config']['bootstrap_url']+'/'+dcos_version_specifier+'/genconf/serve' }) | to_yaml }}
{{ dcos_config | combine({'bootstrap_url': dcos_config['bootstrap_url']+'/'+dcos_version_specifier+'/genconf/serve' }) | to_yaml }}

0 comments on commit 220f0d7

Please sign in to comment.