mirror-env/roles/mirror/tasks/main.yml

82 lines
2.0 KiB
YAML

- name: copy cron job
copy:
src: "{{ role_path }}/templates/cron/csc-mirror"
dest: /etc/cron.d/csc-mirror
owner: root
group: root
mode: "0644"
# TODO: start/restart cron
- name: copy mirror home
copy:
src: "{{ role_path }}/templates/mirror/"
dest: /home/mirror
owner: mirror
group: mirror
mode: preserve
- name: copy include
copy:
src: "{{ role_path }}/templates/root/root/include/"
dest: /mirror/root/include
owner: root
group: csc-mirror
mode: preserve
- name: create merlin directories
file:
path: /mirror/merlin
owner: root
group: root
mode: "0755"
- name: create merlin subdirectories
file:
path: "/mirror/merlin/{{ item.file }}"
owner: "{{ item.owner }}"
group: "{{ item.owner }}"
mode: "0755"
loop:
- { file: bin, owner: root }
- { file: dev, owner: root }
- { file: run, owner: mirror }
- name: copy over arthur and busybox
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: "0755"
loop:
- src: "{{ role_path }}/templates/root/merlin/arthur"
dest: "/mirror/merlin/arthur"
- src: "/usr/bin/busybox"
dest: "/mirror/merlin/bin/busybox"
- name: create symlinks
# noqa deprecated-command-syntax
# need chdir to create relative symlinks
command:
cmd: "ln -s {{ item.src }} {{ item.dest }}"
chdir: "/mirror/merlin/run"
creates: "/mirror/merlin/run/{{ item.dest }}"
loop:
- { src: busybox, dest: cd }
- { src: busybox, dest: cp }
- { src: busybox, dest: ln }
- { src: busybox, dest: ls }
- { src: busybox, dest: rm }
- { src: busybox, dest: sh }
- { src: busybox, dest: sleep }
- { src: ../arthur, dest: arthur }
# startup merlin to get
# /mirror/merlin/run/merlin.sock
# then symlink to /mirror/merlin/merlin.sock
# and /home/mirror/merlin/merlin.sock
# in /mirror/merlin/dev need to create null random urandom with mknod
# might not need the root/merlin/(bin|dev|run) and just make the empty dirs
# where does arthur come from?