---
- name: "Land SSH config for clusterid"
  blockinfile:
    path: "~/.ssh/config-{{ clusterid }}.{{ dns_domain }}"
    create: yes
    marker: "#<!-- {mark} OUTPUT -->"
    content: |
      {{ lookup('template', ( playbook_dir + '/roles/aws/templates/ssh_config.j2') ) }}

- name: "Land domain delegation for clusterid"
  blockinfile:
    path: "~/.ssh/config-{{ clusterid }}.{{ dns_domain }}-domaindelegation"
    create: yes
    marker: "#<!-- {mark} OUTPUT -->"
    content: |
      {{ lookup('template', ( playbook_dir + '/roles/aws/templates/outputdomaindeleg.j2') ) }}

- name: "Land openshift-ansible installer cloudprovider_kind and credentials"
  blockinfile:
    path: "~/.ssh/config-{{ clusterid }}.{{ dns_domain }}-cpk"
    create: yes
    marker: "#<!-- {mark} OUTPUT -->"
    content: |
      {{ lookup('template', ( playbook_dir + '/roles/aws/templates/outputcpk.j2') ) }}

- name: "Land openshift-ansible installer registry storage kind and credentials"
  blockinfile:
    path: "~/.ssh/config-{{ clusterid }}.{{ dns_domain }}-s3"
    create: yes
    marker: "#<!-- {mark} OUTPUT -->"
    content: |
      {{ lookup('template', ( playbook_dir + '/roles/aws/templates/outputs3.j2') ) }}

- name: "Land openshift-ansible installer urls"
  blockinfile:
    path: "~/.ssh/config-{{ clusterid }}.{{ dns_domain }}-urls"
    create: yes
    marker: "#<!-- {mark} OUTPUT -->"
    content: |
      {{ lookup('template', ( playbook_dir + '/roles/aws/templates/outputurls.j2') ) }}

- name: "Land openshift-ansible installer host inventory"
  template:
    dest: "~/.ssh/config-{{ clusterid }}.{{ dns_domain }}-hosts"
    trim_blocks: no
    src: "{{ playbook_dir }}/roles/aws/templates/outputhosts.j2"
