diff --git a/README.md b/README.md index c8c2625..5dc1c90 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,19 @@ password: ubuntu ``` ## Post-Installation -There are some things that will not be setup post install. As of now, it is also required to run a shell script to further configure the system. We will streamline this in the future. +The ubunutu autoinstall can only handle basic installation. We require a more powerful tool to configure the post-install environment. For this reason, we will be using ansible. + +First, install ansible and sshpass. Perform all the following commands in the `post-install/` directory. + +Check that ansible can talk to the vm: +``` +$ ansible -m ping all +``` + +We can now complete the rest of the post-install with +``` +$ ansible-playbook -K playbook.yml +``` ## System Details For those that are interested. diff --git a/mirror/README.md b/mirror/README.md deleted file mode 100644 index b7d95fd..0000000 --- a/mirror/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Mirror -After setting up the vm this playbook will setup mirror's services -## Instructions -Install ansible then run the playbook -``` -apt install -y ansible -ansible-playbook main.yml -``` diff --git a/mirror/main.yml b/mirror/main.yml deleted file mode 100644 index 5a219cf..0000000 --- a/mirror/main.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -# https://wiki.csclub.uwaterloo.ca/Mirror -# -# may want to split this into multiple files -# -# right now we will just take configs from mirror -# later we will edit them as required -# -# user should running this as root:root -# so unsure if need to set owner:group for files/dirs -# -# unsure that hosts does -- hosts: 127.0.0.1 - tasks: - - name: install dependencies - apt: - pkg: - - zfsutils-linux - - rsync - - nginx - - proftpd - state: latest - update_cache: true - state: started - - name: create zfs mountpoint - file: - path: /mirror/root/.cscmirror - state: directory - owner: root - group: root - mode: 0777 - recurse: yes - - name: create and mount zpool - # double check this works (and produces the correct result) - # may be better to use the /dev/disk/by-id/... instead - commmand: zpool create -f -m /mirror/root/.cscmirror cscmirror raidz2 /dev/vdc /dev/vdd /dev/vde /dev/vdf - # may need to mount it (also check that it will automount on boot) - # zfs mount -a - - name: enable and start rsync daemon - systemd: - name: rsync - enabled: true - state: started - - name: add rsync config - template: - src: rsync/rsyncd.conf.j2 - dest: /etc/rsyncd.conf - owner: root - group: root - mode: 0644 - template: - src: rsync/rsyncd-filter.conf.j2 - dest: /etc/rsyncd-filter.conf - owner: root - group: root - mode: 0644 - notify: restart rsync - diff --git a/post-install/ansible.cfg b/post-install/ansible.cfg new file mode 100755 index 0000000..ed865bf --- /dev/null +++ b/post-install/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +inventory = hosts diff --git a/post-install/hosts b/post-install/hosts new file mode 100755 index 0000000..ef40453 --- /dev/null +++ b/post-install/hosts @@ -0,0 +1,7 @@ +ubuntu@localhost + +[all:vars] +ansible_connection=ssh +ansible_port=7777 +ansible_user=ubuntu +ansible_password=ubuntu diff --git a/post-install/playbook.yml b/post-install/playbook.yml new file mode 100755 index 0000000..f9140cf --- /dev/null +++ b/post-install/playbook.yml @@ -0,0 +1,7 @@ +--- +- hosts: all + become: true + roles: + - setup + - zfs + - rsync diff --git a/post-install/roles/rsync/tasks/main.yml b/post-install/roles/rsync/tasks/main.yml new file mode 100755 index 0000000..32d2765 --- /dev/null +++ b/post-install/roles/rsync/tasks/main.yml @@ -0,0 +1,20 @@ +- name: enable and start rsync daemon + systemd: + name: rsync + enabled: true + state: started + +- name: add rsync config + template: + src: ../templates/rsyncd.conf.j2 + dest: /etc/rsyncd.conf + owner: root + group: root + mode: 0644 + template: + src: ../templates/rsyncd-filter.conf.j2 + dest: /etc/rsyncd-filter.conf + owner: root + group: root + mode: 0644 + notify: restart rsync diff --git a/mirror/rsync/rsyncd-filter.conf.j2 b/post-install/roles/rsync/templates/rsyncd-filter.conf.j2 old mode 100644 new mode 100755 similarity index 100% rename from mirror/rsync/rsyncd-filter.conf.j2 rename to post-install/roles/rsync/templates/rsyncd-filter.conf.j2 diff --git a/mirror/rsync/rsyncd.conf.j2 b/post-install/roles/rsync/templates/rsyncd.conf.j2 old mode 100644 new mode 100755 similarity index 100% rename from mirror/rsync/rsyncd.conf.j2 rename to post-install/roles/rsync/templates/rsyncd.conf.j2 diff --git a/post-install/roles/setup/tasks/main.yml b/post-install/roles/setup/tasks/main.yml new file mode 100755 index 0000000..b98fe34 --- /dev/null +++ b/post-install/roles/setup/tasks/main.yml @@ -0,0 +1,9 @@ +- name: install dependencies + apt: + pkg: + - zfsutils-linux + - rsync + - nginx + - proftpd + state: latest + update_cache: true diff --git a/post-install/roles/zfs/tasks/main.yml b/post-install/roles/zfs/tasks/main.yml new file mode 100755 index 0000000..035283e --- /dev/null +++ b/post-install/roles/zfs/tasks/main.yml @@ -0,0 +1,15 @@ +- name: create zfs mountpoint + file: + path: /mirror/root/.cscmirror + state: directory + owner: root + group: root + mode: 0777 + recurse: yes + +- name: create and mount zpool + # double check this works (and produces the correct result) + # may be better to use the /dev/disk/by-id/... instead + commmand: zpool create -f -m /mirror/root/.cscmirror cscmirror raidz2 /dev/vdc /dev/vdd /dev/vde /dev/vdf + # may need to mount it (also check that it will automount on boot) + # zfs mount -a