diff --git a/.gitignore b/.gitignore index 419117c..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +0,0 @@ -*.iso -disks/ - diff --git a/hosts b/hosts index bcd01aa..c2abc5a 100644 --- a/hosts +++ b/hosts @@ -1,3 +1,5 @@ +# I will move this to the hosts.yml soon + [vm] 192.168.123.2 host=mirror ansible_connection=ssh ansible_port=22 ansible_user=ubuntu ansible_password=ubuntu ansible_become_user=root ansible_become_password=ubuntu # ansible_ssh_private_key_file diff --git a/libvirt/main.yml b/libvirt/main.yml index c9669a9..f214265 100644 --- a/libvirt/main.yml +++ b/libvirt/main.yml @@ -45,7 +45,6 @@ {{ playbook_dir }}/templates/user-data creates: "{{ playbook_dir }}/vm/seed.qcow2" - # get user to set net.ipv4.ip_forward = 1 ? - name: create mirbr0 bridge network command: "virsh {{ item }}" loop: @@ -95,6 +94,8 @@ --graphics vnc,port=5911,listen=127.0.0.1 --noautoconsole when: not vm_exists.rc == 0 + # get user to set net.ipv4.ip_forward = 1 ? + # in the vm to disable cloud-init run # sudo touch /etc/cloud/cloud-init.disabled @@ -102,22 +103,22 @@ # copy over pub key into /root/.ssh/authorized_keys # add line to ssh config that allows ssh as root -# possible that this will not be run in order? +- name: setup mirror vm + hosts: 192.168.123.2 + tasks: + - name: setup system + import_role: + name: "../roles/system" -# roles are called relative to playbook -# - name: setup mirror services -# hosts: 192.168.123.2 -# include_role: "../roles/{{ item }}" -# loop: -# - zfs (make sure runs first) -# - index -# - nginx -# - rsync -# - ftp + - name: setup mirror + import_role: + name: "../roles/mirror" -# to write -# - could be combined into one - # - merlin - # - scripts (in bin) - # - mirrormanager -# - users \ No newline at end of file + - name: setup other services + import_role: + name: "../roles/{{ item }}" + loop: + - ftp + - nginx + - rsync + # - mirrormanager \ No newline at end of file diff --git a/libvirt/templates/user-data b/libvirt/templates/user-data index 4684dea..abf40ca 100644 --- a/libvirt/templates/user-data +++ b/libvirt/templates/user-data @@ -3,10 +3,12 @@ autoinstall: version: 1 identity: hostname: mirror - username: ubuntu + username: local # mkpasswd --method=SHA-512 --rounds=4096 - # password is just ubuntu - password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" + # password is krb5 + password: "$6$rounds=4096$FfXwns8mexFJUAjS$z/ERS/5gitnl8f3AZnnztS8iFpmS/AtzUfEVM2.tfRpWnl/y7PwhDZTeT68WxoogmSTgaZyVL6..jP4aiB1LD0" + # this password is ubuntu + # $6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0 locale: en_US ssh: allow-pw: true diff --git a/local/README.md b/local/README.md new file mode 100644 index 0000000..e14b6a7 --- /dev/null +++ b/local/README.md @@ -0,0 +1,7 @@ +# local playbook +this playbook will be run inside a already set up vm to set up the services + +used if someone wants to set up vm themselves + wants more disks in the pool + +includes varable for which disks to turn into a zfs pool + diff --git a/todo/README.md b/roles/README.md similarity index 58% rename from todo/README.md rename to roles/README.md index 5e8678b..03ec2aa 100644 --- a/todo/README.md +++ b/roles/README.md @@ -21,3 +21,22 @@ check wiki for more details ### Sync Scripts add sync scripts to `~mirror/bin` + + +merge all mirror stuff into mirror role + +setup role that creates zpools and users + +# to write +- ftp +- mirror +- setup +- local + +# to update +- hosts + ansible.cfg +- group_vars +- quote the file mode (0777 -> '0777') +- add directory_mode to set directory permission +- double check src and dest behaviour with trailing / + - could check that copy works like rsync \ No newline at end of file diff --git a/roles/ftp/tasks/main.yml b/roles/ftp/tasks/main.yml new file mode 100644 index 0000000..f2daba5 --- /dev/null +++ b/roles/ftp/tasks/main.yml @@ -0,0 +1,31 @@ +- name: install proftpd + apt: + name: proftpd + state: present + update_cache: yes + + +# make `/mirror/root` dir + +# will this overwrite the /mirror/root/include ? + +# double check perms + +# proftpd requires modules (how to install ?) +- name: Copy assets + copy: + src: "{{ role_path }}/templates/proftpd.conf" + dest: /etc/proftpd/proftpd.conf + # owner: root + # group: root + # mode: 0755 + + +# also need to get +# /etc/proftpd/blacklist.dat (binary) +# /etc/proftpd/dhparams.pem (maybe not) +# /etc/proftpd/ldap.conf (unable to read) +# /etc/proftpd/modules.conf (and maybe everything in /usr/lib/proftpd/) +# /etc/proftpd/sql.conf (unable to read) +# /etc/proftpd/tls.conf +# /etc/proftpd/virtuals.conf \ No newline at end of file diff --git a/todo/ftp/templates/proftpd.conf b/roles/ftp/templates/proftpd.conf similarity index 100% rename from todo/ftp/templates/proftpd.conf rename to roles/ftp/templates/proftpd.conf diff --git a/roles/index/tasks/main.yml b/roles/index/tasks/main.yml deleted file mode 100644 index bb3910c..0000000 --- a/roles/index/tasks/main.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- name: copy over crond job - copy: - src: "{{ role_path }}/templates/csc-mirror" - dest: /etc/cron.d/csc-mirror - owner: root - group: root - mode: 0644 -# restart cron - -# create mirror home dir in user role -# - name: mirror home -# file: -# path: /home/mirror -# state: directory -# owner: mirror -# group: mirror -# mode: 0755 -# recurse: yes - -# user template module instead -# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html -- name: Copy index files - copy: - src: "{{ role_path }}/templates/mirror-index" - dest: /home/mirror/mirror-index - owner: mirror - group: mirror - mode: 0775 - -- name: Copy assets - copy: - src: "{{ role_path }}/templates/include" - dest: /mirror/root/include - owner: root - group: csc-mirror - mode: 0755 - diff --git a/roles/mirror.txt b/roles/mirror.txt new file mode 100644 index 0000000..df804ae --- /dev/null +++ b/roles/mirror.txt @@ -0,0 +1,25 @@ +troubleshooting: try to load the kvm module with `modprobe kvm_intel` + +interface should automatically come up but can also use +$ virt-viewer --domain-name mirror +if vm is on a remote machine +$ virt-viewer --connect qemu+ssh://user@host.example.com/system vmnamehere + +for now just have a folder of screenshots +- change name of lvm volume from "lv0-root" to just "root" +troubleshooting: ignore "failed to unmount /cdrom" and just ctrl+c in viewer + +login into your created user (from install), change to root, and create password for root +$ sudo su +type in your password +$ passwd +create root password + +may already be mounted but just to be sure +$ zfs mount -a + +- mirror hosts + - http://mirror.csclub.uwaterloo.ca (the mirror) + - http://ca.releases.ubuntu.com (ubuntu releases) + - http://ca.ceph.com (ceph releases) + - http://debian.csclub.uwaterloo.ca (csclub's debian packages) diff --git a/roles/mirror/tasks/main.yml b/roles/mirror/tasks/main.yml new file mode 100644 index 0000000..b705aac --- /dev/null +++ b/roles/mirror/tasks/main.yml @@ -0,0 +1,73 @@ +# setup will folders and users for us to use here + +# merlin will create +# /mirror/merlin/run + run/merlin.sock + +# do we need to create ln -s from /mirror/merlin/run/merlin.sock to /mirror/merlin/merlin.sock + +# - name: set up /home/mirror + + + + +- name: copy over crond job + copy: + src: "{{ role_path }}/templates/csc-mirror" + dest: /etc/cron.d/csc-mirror + owner: root + group: root + mode: 0644 +# restart cron + +# create mirror home dir in user role +# - name: mirror home +# file: +# path: /home/mirror +# state: directory +# owner: mirror +# group: mirror +# mode: 0755 +# recurse: yes + +# also create /mirror/root + +- name: Copy index files + copy: + src: "{{ role_path }}/templates/mirror-index" + dest: /home/mirror/mirror-index + owner: mirror + group: mirror + mode: 0775 + +- name: Copy assets + copy: + src: "{{ role_path }}/templates/include" + dest: /mirror/root/include + owner: root + group: csc-mirror + mode: 0755 + + +# merlin goes goes under /home + +# csc-mirror goes under /etc/cron.d + +# include and merlin go under /mirror + + +# delete symlinks and recreate when installing + +# the git repo @mirror only update with /home/mirror + +# could just rsync whatever is in that repo to /home/mirror + +# unable to read files with +s +# - /mirror/merlin/run/merlin.sock +# what the: looks like python will create this +# may need to ln -s from run/merlin.sock to /mirror/merlin/merlin.sock and /home/mirror/merlin/merlin.sock + +# for busybox +# ln -s /bin/busybox ls +# then ./ls will execute ls from busybox + +# in /mirror/merlin/dev need to create null random urandom with mknod \ No newline at end of file diff --git a/roles/index/templates/csc-mirror b/roles/mirror/templates/cron/csc-mirror similarity index 100% rename from roles/index/templates/csc-mirror rename to roles/mirror/templates/cron/csc-mirror diff --git a/todo/mirror/bin/csc-sync-apache b/roles/mirror/templates/mirror/bin/csc-sync-apache similarity index 100% rename from todo/mirror/bin/csc-sync-apache rename to roles/mirror/templates/mirror/bin/csc-sync-apache diff --git a/todo/mirror/bin/csc-sync-archlinux b/roles/mirror/templates/mirror/bin/csc-sync-archlinux similarity index 100% rename from todo/mirror/bin/csc-sync-archlinux rename to roles/mirror/templates/mirror/bin/csc-sync-archlinux diff --git a/todo/mirror/bin/csc-sync-archlinux-old b/roles/mirror/templates/mirror/bin/csc-sync-archlinux-old similarity index 100% rename from todo/mirror/bin/csc-sync-archlinux-old rename to roles/mirror/templates/mirror/bin/csc-sync-archlinux-old diff --git a/todo/mirror/bin/csc-sync-badperms b/roles/mirror/templates/mirror/bin/csc-sync-badperms similarity index 100% rename from todo/mirror/bin/csc-sync-badperms rename to roles/mirror/templates/mirror/bin/csc-sync-badperms diff --git a/todo/mirror/bin/csc-sync-cdimage b/roles/mirror/templates/mirror/bin/csc-sync-cdimage similarity index 100% rename from todo/mirror/bin/csc-sync-cdimage rename to roles/mirror/templates/mirror/bin/csc-sync-cdimage diff --git a/todo/mirror/bin/csc-sync-ceph b/roles/mirror/templates/mirror/bin/csc-sync-ceph similarity index 100% rename from todo/mirror/bin/csc-sync-ceph rename to roles/mirror/templates/mirror/bin/csc-sync-ceph diff --git a/todo/mirror/bin/csc-sync-chmod b/roles/mirror/templates/mirror/bin/csc-sync-chmod similarity index 100% rename from todo/mirror/bin/csc-sync-chmod rename to roles/mirror/templates/mirror/bin/csc-sync-chmod diff --git a/todo/mirror/bin/csc-sync-debian b/roles/mirror/templates/mirror/bin/csc-sync-debian similarity index 100% rename from todo/mirror/bin/csc-sync-debian rename to roles/mirror/templates/mirror/bin/csc-sync-debian diff --git a/todo/mirror/bin/csc-sync-debian-cd b/roles/mirror/templates/mirror/bin/csc-sync-debian-cd similarity index 100% rename from todo/mirror/bin/csc-sync-debian-cd rename to roles/mirror/templates/mirror/bin/csc-sync-debian-cd diff --git a/todo/mirror/bin/csc-sync-gentoo b/roles/mirror/templates/mirror/bin/csc-sync-gentoo similarity index 100% rename from todo/mirror/bin/csc-sync-gentoo rename to roles/mirror/templates/mirror/bin/csc-sync-gentoo diff --git a/todo/mirror/bin/csc-sync-s3 b/roles/mirror/templates/mirror/bin/csc-sync-s3 similarity index 100% rename from todo/mirror/bin/csc-sync-s3 rename to roles/mirror/templates/mirror/bin/csc-sync-s3 diff --git a/todo/mirror/bin/csc-sync-ssh b/roles/mirror/templates/mirror/bin/csc-sync-ssh similarity index 100% rename from todo/mirror/bin/csc-sync-ssh rename to roles/mirror/templates/mirror/bin/csc-sync-ssh diff --git a/todo/mirror/bin/csc-sync-standard b/roles/mirror/templates/mirror/bin/csc-sync-standard similarity index 100% rename from todo/mirror/bin/csc-sync-standard rename to roles/mirror/templates/mirror/bin/csc-sync-standard diff --git a/todo/mirror/bin/csc-sync-standard-ipv6 b/roles/mirror/templates/mirror/bin/csc-sync-standard-ipv6 similarity index 100% rename from todo/mirror/bin/csc-sync-standard-ipv6 rename to roles/mirror/templates/mirror/bin/csc-sync-standard-ipv6 diff --git a/todo/mirror/bin/csc-sync-wget b/roles/mirror/templates/mirror/bin/csc-sync-wget similarity index 100% rename from todo/mirror/bin/csc-sync-wget rename to roles/mirror/templates/mirror/bin/csc-sync-wget diff --git a/todo/mirror/bin/make-torrents b/roles/mirror/templates/mirror/bin/make-torrents similarity index 100% rename from todo/mirror/bin/make-torrents rename to roles/mirror/templates/mirror/bin/make-torrents diff --git a/todo/mirror/bin/report_mirror b/roles/mirror/templates/mirror/bin/report_mirror similarity index 100% rename from todo/mirror/bin/report_mirror rename to roles/mirror/templates/mirror/bin/report_mirror diff --git a/todo/mirror/bin/ubuntu-releases-sync b/roles/mirror/templates/mirror/bin/ubuntu-releases-sync similarity index 100% rename from todo/mirror/bin/ubuntu-releases-sync rename to roles/mirror/templates/mirror/bin/ubuntu-releases-sync diff --git a/todo/mirror/bin/zfssync b/roles/mirror/templates/mirror/bin/zfssync similarity index 100% rename from todo/mirror/bin/zfssync rename to roles/mirror/templates/mirror/bin/zfssync diff --git a/todo/mirror/config/ADDRESS b/roles/mirror/templates/mirror/config/ADDRESS similarity index 100% rename from todo/mirror/config/ADDRESS rename to roles/mirror/templates/mirror/config/ADDRESS diff --git a/todo/mirror/config/ADDRESS_V6 b/roles/mirror/templates/mirror/config/ADDRESS_V6 similarity index 100% rename from todo/mirror/config/ADDRESS_V6 rename to roles/mirror/templates/mirror/config/ADDRESS_V6 diff --git a/todo/mirror/debian/.bash_logout b/roles/mirror/templates/mirror/debian/.bash_logout similarity index 100% rename from todo/mirror/debian/.bash_logout rename to roles/mirror/templates/mirror/debian/.bash_logout diff --git a/todo/mirror/debian/.bash_profile b/roles/mirror/templates/mirror/debian/.bash_profile similarity index 100% rename from todo/mirror/debian/.bash_profile rename to roles/mirror/templates/mirror/debian/.bash_profile diff --git a/todo/mirror/debian/.bashrc b/roles/mirror/templates/mirror/debian/.bashrc similarity index 100% rename from todo/mirror/debian/.bashrc rename to roles/mirror/templates/mirror/debian/.bashrc diff --git a/todo/mirror/debian/README b/roles/mirror/templates/mirror/debian/README similarity index 100% rename from todo/mirror/debian/README rename to roles/mirror/templates/mirror/debian/README diff --git a/todo/mirror/debian/bin/dircombine b/roles/mirror/templates/mirror/debian/bin/dircombine similarity index 100% rename from todo/mirror/debian/bin/dircombine rename to roles/mirror/templates/mirror/debian/bin/dircombine diff --git a/todo/mirror/debian/bin/ftpsync b/roles/mirror/templates/mirror/debian/bin/ftpsync similarity index 100% rename from todo/mirror/debian/bin/ftpsync rename to roles/mirror/templates/mirror/debian/bin/ftpsync diff --git a/todo/mirror/debian/bin/pushpdo b/roles/mirror/templates/mirror/debian/bin/pushpdo similarity index 100% rename from todo/mirror/debian/bin/pushpdo rename to roles/mirror/templates/mirror/debian/bin/pushpdo diff --git a/todo/mirror/debian/bin/runmirrors b/roles/mirror/templates/mirror/debian/bin/runmirrors similarity index 100% rename from todo/mirror/debian/bin/runmirrors rename to roles/mirror/templates/mirror/debian/bin/runmirrors diff --git a/todo/mirror/debian/bin/typicalsync b/roles/mirror/templates/mirror/debian/bin/typicalsync similarity index 100% rename from todo/mirror/debian/bin/typicalsync rename to roles/mirror/templates/mirror/debian/bin/typicalsync diff --git a/todo/mirror/debian/bin/udh b/roles/mirror/templates/mirror/debian/bin/udh similarity index 100% rename from todo/mirror/debian/bin/udh rename to roles/mirror/templates/mirror/debian/bin/udh diff --git a/todo/mirror/debian/bin/websync b/roles/mirror/templates/mirror/debian/bin/websync similarity index 100% rename from todo/mirror/debian/bin/websync rename to roles/mirror/templates/mirror/debian/bin/websync diff --git a/todo/mirror/debian/etc/common b/roles/mirror/templates/mirror/debian/etc/common similarity index 100% rename from todo/mirror/debian/etc/common rename to roles/mirror/templates/mirror/debian/etc/common diff --git a/todo/mirror/debian/etc/ftpsync.conf b/roles/mirror/templates/mirror/debian/etc/ftpsync.conf similarity index 100% rename from todo/mirror/debian/etc/ftpsync.conf rename to roles/mirror/templates/mirror/debian/etc/ftpsync.conf diff --git a/todo/mirror/debian/etc/ftpsync.conf.sample b/roles/mirror/templates/mirror/debian/etc/ftpsync.conf.sample similarity index 100% rename from todo/mirror/debian/etc/ftpsync.conf.sample rename to roles/mirror/templates/mirror/debian/etc/ftpsync.conf.sample diff --git a/todo/mirror/debian/etc/pushpdo.conf.sample b/roles/mirror/templates/mirror/debian/etc/pushpdo.conf.sample similarity index 100% rename from todo/mirror/debian/etc/pushpdo.conf.sample rename to roles/mirror/templates/mirror/debian/etc/pushpdo.conf.sample diff --git a/todo/mirror/debian/etc/pushpdo.mirror.sample b/roles/mirror/templates/mirror/debian/etc/pushpdo.mirror.sample similarity index 100% rename from todo/mirror/debian/etc/pushpdo.mirror.sample rename to roles/mirror/templates/mirror/debian/etc/pushpdo.mirror.sample diff --git a/todo/mirror/debian/etc/runmirrors.conf.sample b/roles/mirror/templates/mirror/debian/etc/runmirrors.conf.sample similarity index 100% rename from todo/mirror/debian/etc/runmirrors.conf.sample rename to roles/mirror/templates/mirror/debian/etc/runmirrors.conf.sample diff --git a/todo/mirror/debian/etc/runmirrors.mirror.sample b/roles/mirror/templates/mirror/debian/etc/runmirrors.mirror.sample similarity index 100% rename from todo/mirror/debian/etc/runmirrors.mirror.sample rename to roles/mirror/templates/mirror/debian/etc/runmirrors.mirror.sample diff --git a/todo/mirror/debian/etc/secrets/.dummy b/roles/mirror/templates/mirror/debian/etc/secrets/.dummy similarity index 100% rename from todo/mirror/debian/etc/secrets/.dummy rename to roles/mirror/templates/mirror/debian/etc/secrets/.dummy diff --git a/todo/mirror/debian/etc/websync.conf.sample b/roles/mirror/templates/mirror/debian/etc/websync.conf.sample similarity index 100% rename from todo/mirror/debian/etc/websync.conf.sample rename to roles/mirror/templates/mirror/debian/etc/websync.conf.sample diff --git a/todo/mirror/debian/mirrorcheck/bin/dmc-archive.pl b/roles/mirror/templates/mirror/debian/mirrorcheck/bin/dmc-archive.pl similarity index 100% rename from todo/mirror/debian/mirrorcheck/bin/dmc-archive.pl rename to roles/mirror/templates/mirror/debian/mirrorcheck/bin/dmc-archive.pl diff --git a/todo/mirror/debian/mirrorcheck/bin/dmc.pl b/roles/mirror/templates/mirror/debian/mirrorcheck/bin/dmc.pl similarity index 100% rename from todo/mirror/debian/mirrorcheck/bin/dmc.pl rename to roles/mirror/templates/mirror/debian/mirrorcheck/bin/dmc.pl diff --git a/todo/mirror/debian/mirrorcheck/www/.dummy b/roles/mirror/templates/mirror/debian/mirrorcheck/www/.dummy similarity index 100% rename from todo/mirror/debian/mirrorcheck/www/.dummy rename to roles/mirror/templates/mirror/debian/mirrorcheck/www/.dummy diff --git a/todo/mirror/foooooooo b/roles/mirror/templates/mirror/foooooooo similarity index 100% rename from todo/mirror/foooooooo rename to roles/mirror/templates/mirror/foooooooo diff --git a/todo/mirror/git_old/include/FOOTER.shtml b/roles/mirror/templates/mirror/git_old/include/FOOTER.shtml similarity index 100% rename from todo/mirror/git_old/include/FOOTER.shtml rename to roles/mirror/templates/mirror/git_old/include/FOOTER.shtml diff --git a/todo/mirror/git_old/include/HEADER.shtml b/roles/mirror/templates/mirror/git_old/include/HEADER.shtml similarity index 100% rename from todo/mirror/git_old/include/HEADER.shtml rename to roles/mirror/templates/mirror/git_old/include/HEADER.shtml diff --git a/todo/mirror/git_old/include/default.css b/roles/mirror/templates/mirror/git_old/include/default.css similarity index 100% rename from todo/mirror/git_old/include/default.css rename to roles/mirror/templates/mirror/git_old/include/default.css diff --git a/roles/index/templates/include/favicon.ico b/roles/mirror/templates/mirror/git_old/include/favicon.ico similarity index 100% rename from roles/index/templates/include/favicon.ico rename to roles/mirror/templates/mirror/git_old/include/favicon.ico diff --git a/roles/index/templates/include/header.png b/roles/mirror/templates/mirror/git_old/include/header.png similarity index 100% rename from roles/index/templates/include/header.png rename to roles/mirror/templates/mirror/git_old/include/header.png diff --git a/todo/mirror/git_old/include/motd.msg b/roles/mirror/templates/mirror/git_old/include/motd.msg similarity index 100% rename from todo/mirror/git_old/include/motd.msg rename to roles/mirror/templates/mirror/git_old/include/motd.msg diff --git a/todo/mirror/git_old/include/robots.txt b/roles/mirror/templates/mirror/git_old/include/robots.txt similarity index 100% rename from todo/mirror/git_old/include/robots.txt rename to roles/mirror/templates/mirror/git_old/include/robots.txt diff --git a/todo/mirror/git_old/misc/debian-check-md5sum b/roles/mirror/templates/mirror/git_old/misc/debian-check-md5sum similarity index 100% rename from todo/mirror/git_old/misc/debian-check-md5sum rename to roles/mirror/templates/mirror/git_old/misc/debian-check-md5sum diff --git a/todo/mirror/git_old/routing/csc-mirror b/roles/mirror/templates/mirror/git_old/routing/csc-mirror similarity index 100% rename from todo/mirror/git_old/routing/csc-mirror rename to roles/mirror/templates/mirror/git_old/routing/csc-mirror diff --git a/todo/mirror/git_old/routing/interfaces b/roles/mirror/templates/mirror/git_old/routing/interfaces similarity index 100% rename from todo/mirror/git_old/routing/interfaces rename to roles/mirror/templates/mirror/git_old/routing/interfaces diff --git a/todo/mirror/git_old/routing/orionroutes.py b/roles/mirror/templates/mirror/git_old/routing/orionroutes.py similarity index 100% rename from todo/mirror/git_old/routing/orionroutes.py rename to roles/mirror/templates/mirror/git_old/routing/orionroutes.py diff --git a/todo/mirror/git_old/routing/rt_realms b/roles/mirror/templates/mirror/git_old/routing/rt_realms similarity index 100% rename from todo/mirror/git_old/routing/rt_realms rename to roles/mirror/templates/mirror/git_old/routing/rt_realms diff --git a/todo/mirror/git_old/routing/rt_tables b/roles/mirror/templates/mirror/git_old/routing/rt_tables similarity index 100% rename from todo/mirror/git_old/routing/rt_tables rename to roles/mirror/templates/mirror/git_old/routing/rt_tables diff --git a/todo/mirror/git_old/routing/update-orion-routes b/roles/mirror/templates/mirror/git_old/routing/update-orion-routes similarity index 100% rename from todo/mirror/git_old/routing/update-orion-routes rename to roles/mirror/templates/mirror/git_old/routing/update-orion-routes diff --git a/todo/mirror/git_old/rrdtool/mirror-nl-glue.c b/roles/mirror/templates/mirror/git_old/rrdtool/mirror-nl-glue.c similarity index 100% rename from todo/mirror/git_old/rrdtool/mirror-nl-glue.c rename to roles/mirror/templates/mirror/git_old/rrdtool/mirror-nl-glue.c diff --git a/todo/mirror/git_old/rrdtool/mirror-nl-glue.h b/roles/mirror/templates/mirror/git_old/rrdtool/mirror-nl-glue.h similarity index 100% rename from todo/mirror/git_old/rrdtool/mirror-nl-glue.h rename to roles/mirror/templates/mirror/git_old/rrdtool/mirror-nl-glue.h diff --git a/todo/mirror/git_old/rrdtool/mirror-rrd.c b/roles/mirror/templates/mirror/git_old/rrdtool/mirror-rrd.c similarity index 100% rename from todo/mirror/git_old/rrdtool/mirror-rrd.c rename to roles/mirror/templates/mirror/git_old/rrdtool/mirror-rrd.c diff --git a/todo/mirror/git_old/rrdtool/rrdgraph-monthly.sh b/roles/mirror/templates/mirror/git_old/rrdtool/rrdgraph-monthly.sh similarity index 100% rename from todo/mirror/git_old/rrdtool/rrdgraph-monthly.sh rename to roles/mirror/templates/mirror/git_old/rrdtool/rrdgraph-monthly.sh diff --git a/todo/mirror/git_old/rrdtool/rrdgraph-yearly.sh b/roles/mirror/templates/mirror/git_old/rrdtool/rrdgraph-yearly.sh similarity index 100% rename from todo/mirror/git_old/rrdtool/rrdgraph-yearly.sh rename to roles/mirror/templates/mirror/git_old/rrdtool/rrdgraph-yearly.sh diff --git a/todo/mirror/git_old/rrdtool/rrdgraph.sh b/roles/mirror/templates/mirror/git_old/rrdtool/rrdgraph.sh similarity index 100% rename from todo/mirror/git_old/rrdtool/rrdgraph.sh rename to roles/mirror/templates/mirror/git_old/rrdtool/rrdgraph.sh diff --git a/todo/mirror/git_old/snmp/.gitignore b/roles/mirror/templates/mirror/git_old/snmp/.gitignore similarity index 100% rename from todo/mirror/git_old/snmp/.gitignore rename to roles/mirror/templates/mirror/git_old/snmp/.gitignore diff --git a/todo/mirror/git_old/snmp/CSC-MIB.txt b/roles/mirror/templates/mirror/git_old/snmp/CSC-MIB.txt similarity index 100% rename from todo/mirror/git_old/snmp/CSC-MIB.txt rename to roles/mirror/templates/mirror/git_old/snmp/CSC-MIB.txt diff --git a/todo/mirror/git_old/snmp/Makefile b/roles/mirror/templates/mirror/git_old/snmp/Makefile similarity index 100% rename from todo/mirror/git_old/snmp/Makefile rename to roles/mirror/templates/mirror/git_old/snmp/Makefile diff --git a/todo/mirror/git_old/snmp/csc-snmp-subagent.c b/roles/mirror/templates/mirror/git_old/snmp/csc-snmp-subagent.c similarity index 100% rename from todo/mirror/git_old/snmp/csc-snmp-subagent.c rename to roles/mirror/templates/mirror/git_old/snmp/csc-snmp-subagent.c diff --git a/todo/mirror/git_old/snmp/mirror-mib.c b/roles/mirror/templates/mirror/git_old/snmp/mirror-mib.c similarity index 100% rename from todo/mirror/git_old/snmp/mirror-mib.c rename to roles/mirror/templates/mirror/git_old/snmp/mirror-mib.c diff --git a/todo/mirror/git_old/snmp/mirror-mib.h b/roles/mirror/templates/mirror/git_old/snmp/mirror-mib.h similarity index 100% rename from todo/mirror/git_old/snmp/mirror-mib.h rename to roles/mirror/templates/mirror/git_old/snmp/mirror-mib.h diff --git a/todo/mirror/git_old/snmp/mirror-nl-glue.c b/roles/mirror/templates/mirror/git_old/snmp/mirror-nl-glue.c similarity index 100% rename from todo/mirror/git_old/snmp/mirror-nl-glue.c rename to roles/mirror/templates/mirror/git_old/snmp/mirror-nl-glue.c diff --git a/todo/mirror/git_old/snmp/mirror-nl-glue.h b/roles/mirror/templates/mirror/git_old/snmp/mirror-nl-glue.h similarity index 100% rename from todo/mirror/git_old/snmp/mirror-nl-glue.h rename to roles/mirror/templates/mirror/git_old/snmp/mirror-nl-glue.h diff --git a/todo/mirror/git_old/snmp/mirror-stats.c b/roles/mirror/templates/mirror/git_old/snmp/mirror-stats.c similarity index 100% rename from todo/mirror/git_old/snmp/mirror-stats.c rename to roles/mirror/templates/mirror/git_old/snmp/mirror-stats.c diff --git a/todo/mirror/git_old/snmp/query_mib.sh b/roles/mirror/templates/mirror/git_old/snmp/query_mib.sh similarity index 100% rename from todo/mirror/git_old/snmp/query_mib.sh rename to roles/mirror/templates/mirror/git_old/snmp/query_mib.sh diff --git a/todo/mirror/git_old/snmp/snmp.conf b/roles/mirror/templates/mirror/git_old/snmp/snmp.conf similarity index 100% rename from todo/mirror/git_old/snmp/snmp.conf rename to roles/mirror/templates/mirror/git_old/snmp/snmp.conf diff --git a/todo/mirror/git_old/torrents/rtorrent-init.d b/roles/mirror/templates/mirror/git_old/torrents/rtorrent-init.d similarity index 100% rename from todo/mirror/git_old/torrents/rtorrent-init.d rename to roles/mirror/templates/mirror/git_old/torrents/rtorrent-init.d diff --git a/todo/mirror/git_old/torrents/rtorrent.rc b/roles/mirror/templates/mirror/git_old/torrents/rtorrent.rc similarity index 100% rename from todo/mirror/git_old/torrents/rtorrent.rc rename to roles/mirror/templates/mirror/git_old/torrents/rtorrent.rc diff --git a/todo/mirror/index.html__ b/roles/mirror/templates/mirror/index.html__ similarity index 100% rename from todo/mirror/index.html__ rename to roles/mirror/templates/mirror/index.html__ diff --git a/todo/mirror/merlin/.gitignore b/roles/mirror/templates/mirror/merlin/.gitignore similarity index 100% rename from todo/mirror/merlin/.gitignore rename to roles/mirror/templates/mirror/merlin/.gitignore diff --git a/todo/mirror/merlin/arthur.py b/roles/mirror/templates/mirror/merlin/arthur.py similarity index 100% rename from todo/mirror/merlin/arthur.py rename to roles/mirror/templates/mirror/merlin/arthur.py diff --git a/todo/mirror/merlin/init-script b/roles/mirror/templates/mirror/merlin/init-script similarity index 100% rename from todo/mirror/merlin/init-script rename to roles/mirror/templates/mirror/merlin/init-script diff --git a/todo/mirror/merlin/merlin.py b/roles/mirror/templates/mirror/merlin/merlin.py similarity index 100% rename from todo/mirror/merlin/merlin.py rename to roles/mirror/templates/mirror/merlin/merlin.py diff --git a/todo/mirror/merlin/merlin.service b/roles/mirror/templates/mirror/merlin/merlin.service similarity index 100% rename from todo/mirror/merlin/merlin.service rename to roles/mirror/templates/mirror/merlin/merlin.service diff --git a/todo/mirror/merlin/rebuild.sh b/roles/mirror/templates/mirror/merlin/rebuild.sh similarity index 100% rename from todo/mirror/merlin/rebuild.sh rename to roles/mirror/templates/mirror/merlin/rebuild.sh diff --git a/todo/mirror/merlin/test.py b/roles/mirror/templates/mirror/merlin/test.py similarity index 100% rename from todo/mirror/merlin/test.py rename to roles/mirror/templates/mirror/merlin/test.py diff --git a/todo/mirror/merlin/test/debianBased b/roles/mirror/templates/mirror/merlin/test/debianBased similarity index 100% rename from todo/mirror/merlin/test/debianBased rename to roles/mirror/templates/mirror/merlin/test/debianBased diff --git a/todo/mirror/merlin/test/debian_update b/roles/mirror/templates/mirror/merlin/test/debian_update similarity index 100% rename from todo/mirror/merlin/test/debian_update rename to roles/mirror/templates/mirror/merlin/test/debian_update diff --git a/todo/mirror/merlin/test/mirror/debian/trace/mirror.csclub.uwaterloo.ca b/roles/mirror/templates/mirror/merlin/test/mirror/debian/trace/mirror.csclub.uwaterloo.ca similarity index 100% rename from todo/mirror/merlin/test/mirror/debian/trace/mirror.csclub.uwaterloo.ca rename to roles/mirror/templates/mirror/merlin/test/mirror/debian/trace/mirror.csclub.uwaterloo.ca diff --git a/todo/mirror/merlin/test/mirror/hobo-linux/mirror.csclub.uwaterloo.ca b/roles/mirror/templates/mirror/merlin/test/mirror/hobo-linux/mirror.csclub.uwaterloo.ca similarity index 100% rename from todo/mirror/merlin/test/mirror/hobo-linux/mirror.csclub.uwaterloo.ca rename to roles/mirror/templates/mirror/merlin/test/mirror/hobo-linux/mirror.csclub.uwaterloo.ca diff --git a/todo/mirror/merlin/test/mirror/ubuntu/trace/mirror.csclub.uwaterloo.ca b/roles/mirror/templates/mirror/merlin/test/mirror/ubuntu/trace/mirror.csclub.uwaterloo.ca similarity index 100% rename from todo/mirror/merlin/test/mirror/ubuntu/trace/mirror.csclub.uwaterloo.ca rename to roles/mirror/templates/mirror/merlin/test/mirror/ubuntu/trace/mirror.csclub.uwaterloo.ca diff --git a/todo/mirror/merlin/test/mirrors b/roles/mirror/templates/mirror/merlin/test/mirrors similarity index 100% rename from todo/mirror/merlin/test/mirrors rename to roles/mirror/templates/mirror/merlin/test/mirrors diff --git a/todo/mirror/merlin/test/sync b/roles/mirror/templates/mirror/merlin/test/sync similarity index 100% rename from todo/mirror/merlin/test/sync rename to roles/mirror/templates/mirror/merlin/test/sync diff --git a/todo/mirror/merlin/test/test_repo_dict b/roles/mirror/templates/mirror/merlin/test/test_repo_dict similarity index 100% rename from todo/mirror/merlin/test/test_repo_dict rename to roles/mirror/templates/mirror/merlin/test/test_repo_dict diff --git a/todo/mirror/merlin/test/trace/leningradskaya.canonical.com b/roles/mirror/templates/mirror/merlin/test/trace/leningradskaya.canonical.com similarity index 100% rename from todo/mirror/merlin/test/trace/leningradskaya.canonical.com rename to roles/mirror/templates/mirror/merlin/test/trace/leningradskaya.canonical.com diff --git a/todo/mirror/merlin/zfssync.yml b/roles/mirror/templates/mirror/merlin/zfssync.yml similarity index 100% rename from todo/mirror/merlin/zfssync.yml rename to roles/mirror/templates/mirror/merlin/zfssync.yml diff --git a/todo/mirror/migration.sh b/roles/mirror/templates/mirror/migration.sh similarity index 100% rename from todo/mirror/migration.sh rename to roles/mirror/templates/mirror/migration.sh diff --git a/roles/index/templates/mirror-index/config.yaml b/roles/mirror/templates/mirror/mirror-index/config.yaml similarity index 100% rename from roles/index/templates/mirror-index/config.yaml rename to roles/mirror/templates/mirror/mirror-index/config.yaml diff --git a/roles/index/templates/mirror-index/index.css b/roles/mirror/templates/mirror/mirror-index/index.css similarity index 100% rename from roles/index/templates/mirror-index/index.css rename to roles/mirror/templates/mirror/mirror-index/index.css diff --git a/roles/index/templates/mirror-index/index.mako b/roles/mirror/templates/mirror/mirror-index/index.mako similarity index 100% rename from roles/index/templates/mirror-index/index.mako rename to roles/mirror/templates/mirror/mirror-index/index.mako diff --git a/roles/index/templates/mirror-index/make-index.py b/roles/mirror/templates/mirror/mirror-index/make-index.py similarity index 100% rename from roles/index/templates/mirror-index/make-index.py rename to roles/mirror/templates/mirror/mirror-index/make-index.py diff --git a/todo/mirror/mirrormanager-client/report_mirror.conf b/roles/mirror/templates/mirror/mirrormanager-client/report_mirror.conf similarity index 100% rename from todo/mirror/mirrormanager-client/report_mirror.conf rename to roles/mirror/templates/mirror/mirrormanager-client/report_mirror.conf diff --git a/todo/mirror/old-crontab b/roles/mirror/templates/mirror/old-crontab similarity index 100% rename from todo/mirror/old-crontab rename to roles/mirror/templates/mirror/old-crontab diff --git a/todo/mirror/update-raid-progress.sh b/roles/mirror/templates/mirror/update-raid-progress.sh similarity index 100% rename from todo/mirror/update-raid-progress.sh rename to roles/mirror/templates/mirror/update-raid-progress.sh diff --git a/roles/mirror/templates/root/merlin/arthur b/roles/mirror/templates/root/merlin/arthur new file mode 100755 index 0000000..49432fa Binary files /dev/null and b/roles/mirror/templates/root/merlin/arthur differ diff --git a/roles/mirror/templates/root/merlin/bin/arthur b/roles/mirror/templates/root/merlin/bin/arthur new file mode 120000 index 0000000..ca45b2a --- /dev/null +++ b/roles/mirror/templates/root/merlin/bin/arthur @@ -0,0 +1 @@ +../arthur \ No newline at end of file diff --git a/roles/mirror/templates/root/merlin/bin/busybox b/roles/mirror/templates/root/merlin/bin/busybox new file mode 100755 index 0000000..5408d3c Binary files /dev/null and b/roles/mirror/templates/root/merlin/bin/busybox differ diff --git a/roles/mirror/templates/root/merlin/bin/cd b/roles/mirror/templates/root/merlin/bin/cd new file mode 120000 index 0000000..c3fa810 --- /dev/null +++ b/roles/mirror/templates/root/merlin/bin/cd @@ -0,0 +1 @@ +busybox \ No newline at end of file diff --git a/roles/mirror/templates/root/merlin/bin/cp b/roles/mirror/templates/root/merlin/bin/cp new file mode 120000 index 0000000..c3fa810 --- /dev/null +++ b/roles/mirror/templates/root/merlin/bin/cp @@ -0,0 +1 @@ +busybox \ No newline at end of file diff --git a/roles/mirror/templates/root/merlin/bin/ln b/roles/mirror/templates/root/merlin/bin/ln new file mode 120000 index 0000000..c3fa810 --- /dev/null +++ b/roles/mirror/templates/root/merlin/bin/ln @@ -0,0 +1 @@ +busybox \ No newline at end of file diff --git a/roles/mirror/templates/root/merlin/bin/ls b/roles/mirror/templates/root/merlin/bin/ls new file mode 120000 index 0000000..c3fa810 --- /dev/null +++ b/roles/mirror/templates/root/merlin/bin/ls @@ -0,0 +1 @@ +busybox \ No newline at end of file diff --git a/roles/mirror/templates/root/merlin/bin/rm b/roles/mirror/templates/root/merlin/bin/rm new file mode 120000 index 0000000..c3fa810 --- /dev/null +++ b/roles/mirror/templates/root/merlin/bin/rm @@ -0,0 +1 @@ +busybox \ No newline at end of file diff --git a/roles/mirror/templates/root/merlin/bin/sh b/roles/mirror/templates/root/merlin/bin/sh new file mode 120000 index 0000000..c3fa810 --- /dev/null +++ b/roles/mirror/templates/root/merlin/bin/sh @@ -0,0 +1 @@ +busybox \ No newline at end of file diff --git a/roles/mirror/templates/root/merlin/bin/sleep b/roles/mirror/templates/root/merlin/bin/sleep new file mode 120000 index 0000000..c3fa810 --- /dev/null +++ b/roles/mirror/templates/root/merlin/bin/sleep @@ -0,0 +1 @@ +busybox \ No newline at end of file diff --git a/roles/mirror/templates/root/merlin/dev/.gitkeep b/roles/mirror/templates/root/merlin/dev/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/todo/mirror/git_old/include/favicon.ico b/roles/mirror/templates/root/root/include/favicon.ico similarity index 100% rename from todo/mirror/git_old/include/favicon.ico rename to roles/mirror/templates/root/root/include/favicon.ico diff --git a/todo/mirror/git_old/include/header.png b/roles/mirror/templates/root/root/include/header.png similarity index 100% rename from todo/mirror/git_old/include/header.png rename to roles/mirror/templates/root/root/include/header.png diff --git a/todo/ftp/templates/include/motd.msg b/roles/mirror/templates/root/root/include/motd.msg similarity index 100% rename from todo/ftp/templates/include/motd.msg rename to roles/mirror/templates/root/root/include/motd.msg diff --git a/roles/zfs/tasks/main.yml b/roles/system/tasks/main.yml similarity index 53% rename from roles/zfs/tasks/main.yml rename to roles/system/tasks/main.yml index 3cab34e..c92a5ed 100755 --- a/roles/zfs/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -27,6 +27,8 @@ set_fact: disk_arg: "{{ disks | join(' ') }}" +# also create /mirror/merlin +# double check that /mirror perms are correct - name: create zfs mountpoint file: path: /mirror/root/.cscmirror @@ -54,4 +56,54 @@ # mount all zpools # zfs mount -a -# may need to mount it (also check that it will automount on boot) \ No newline at end of file +# may need to mount it (also check that it will automount on boot) + +- name: local group + group: + name: local + gid: 1000 + +- name: local user + user: + name: local + shell: /bin/bash + uid: 1000 + group: local + create_home: yes + +- name: mirror group + group: + name: mirror + gid: 1001 + +- name: mirror user + user: + name: mirror + shell: /bin/bash + uid: 1001 + group: mirror + create_home: yes + +- name: push group + group: + name: push + gid: 1002 + +- name: push user + user: + name: push + shell: /bin/sh + uid: 1002 + group: push + create_home: yes + +# ssh to push user should chroot to /mirror/merlin + + +# - create users (and their home dirs) +# - mirror (most mirror related things are owned by this user) +# - local (does nothing) +# - push (stores some authorized_keys so upstream can push to us) +# - csc-mirror (system user, donno what does) +# - modify ssh config to allow root login +# - copy over ssh public keys (if provided) \ No newline at end of file diff --git a/todo/ftp/main.yml b/todo/ftp/main.yml deleted file mode 100644 index a33f204..0000000 --- a/todo/ftp/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: install proftpd - apt: - name: proftpd - state: present - update_cache: yes \ No newline at end of file diff --git a/todo/ftp/templates/README.md b/todo/ftp/templates/README.md deleted file mode 100644 index fc0751f..0000000 --- a/todo/ftp/templates/README.md +++ /dev/null @@ -1,12 +0,0 @@ -make `/mirror/root` dir - -this `include/` dir contains files used by the index.html from index -``` -include/ -> -/mirror/root/include/ -``` - -``` -proftpd.conf -> -/etc/proftpd/proftpd.conf -``` diff --git a/todo/mirror.txt b/todo/mirror.txt deleted file mode 100644 index c8c83b9..0000000 --- a/todo/mirror.txt +++ /dev/null @@ -1,60 +0,0 @@ -remarks -- vm will not have autostart -- storage req: 40GB - - root size: 10GB (x2 for raid 1) - - storage size: 5GB (x4 for raid-z2) - -install (debian) -$ apt install qemu-kvm libvirt virt-install virt-viewer - -install (arch) -$ pacman -S qemu libvirt virt-install virt-viewer - -troubleshooting: try to load the kvm module with `modprobe kvm_intel` - -interface should automatically come up but can also use -$ virt-viewer --domain-name mirror -if vm is on a remote machine -$ virt-viewer --connect qemu+ssh://user@host.example.com/system vmnamehere - -for now just have a folder of screenshots -- change name of lvm volume from "lv0-root" to just "root" -troubleshooting: ignore "failed to unmount /cdrom" and just ctrl+c in viewer - -login into your created user (from install), change to root, and create password for root -$ sudo su -type in your password -$ passwd -create root password - -create zpool (use /dev/disk/by-id/.. instead) -$ apt update -$ apt install zfsutils-linux nginx rsync -$ mkdir -p /mirror/root/.cscmirror -$ zpool create -f -m /mirror/root/.cscmirror cscmirror raidz2 /dev/vdc /dev/vdd /dev/vde /dev/vdf - -may already be mounted but just to be sure -$ zfs mount -a - - -TODO -- configure symlinking from /mirror/root/.cscmirror to /mirror/root -- configure ssh for push sync -- configure nginx -- configure rsync -- set motd? -- configure FTP (using proftpd) -- Merlin in ~mirror/merlin -> /home/mirror/merlin -- ~mirror/merlin/arthur.py status -- ~mirror/merlin/arthur.py sync:PROJECT_NAME -- Sync Scripts in ~mirror/bin (and repo, but repo has less) - - take params local_dir rsync_host rsync_dir -- check out csclub wiki mirror administration for adding a new project and project sync - - -- ask if can ignore /mirror/newroot -- mirror hosts - - http://mirror.csclub.uwaterloo.ca (the mirror) - - http://ca.releases.ubuntu.com (ubuntu releases) - - http://ca.ceph.com (ceph releases) - - http://debian.csclub.uwaterloo.ca (csclub's debian packages) diff --git a/todo/users/README.md b/todo/users/README.md deleted file mode 100644 index 7e5fb0e..0000000 --- a/todo/users/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# setup role for container -- create users (and their home dirs) - - mirror (most mirror related things are owned by this user) - - local (does nothing) - - push (stores some authorized_keys so upstream can push to us) - - csc-mirror (system user, donno what does) -- modify ssh config to allow root login -- copy over ssh public keys (if provided) \ No newline at end of file