--- /dev/null
+#Configure access to cicd docker registry.
+- name: "Ensure that docker config directory exists"
+  file:
+    path: /etc/docker
+    mode: 0700
+    state: directory
+- name: "Allow insecure access to cicd docker registry"
+  template:
+    src: daemon.json.j2
+    dest: /etc/docker/daemon.json
 
--- /dev/null
+#General instance configuration.
+#Modify /etc/hosts on every instance to add every instance there including itself.
+- name: "Add hosts to /etc/hosts"
+  lineinfile:
+    path: /etc/hosts
+    insertafter: EOF
+    regexp: "^[^ ]+ {{ item }}$"
+    state: present
+    line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}"
+  loop: "{{ groups['instances'] }}"
+#Copy private ssh key to instances for easy connecting between them.
+- name: "Ensure ssh directory exists"
+  file:
+    path: /root/.ssh
+    owner: root
+    group: root
+    mode: 0700
+    state: directory
+- name: "Install ssh private key"
+  copy:
+    src: "{{ ansible_private_key_file }}"
+    dest: /root/.ssh/id_rsa
+    mode: 0400
+#Add public ssh host keys of all instances to trust them.
+- name: "Add host keys of instances to known_hosts"
+  shell: "ssh-keyscan {{ groups['instances'] | join(' ') }} > /root/.ssh/known_hosts"
 
--- /dev/null
+#Initial instance configuration.
+- include_tasks: general.yml
+#Configure cicd registry access, but skip installer.
+- include_tasks: cicd_registry.yml
+  when: "inventory_hostname != 'installer'"