summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README28
-rw-r--r--host_vars/rudpadami4
-rw-r--r--hosts1
-rw-r--r--roles/rudpad/tasks/main.yml82
-rw-r--r--roles/server/tasks/update.yml4
-rw-r--r--rudpad.yml9
6 files changed, 128 insertions, 0 deletions
diff --git a/README b/README
index 6d2b461..d78fe93 100644
--- a/README
+++ b/README
@@ -29,3 +29,31 @@ To create a fresh pipeliner image:
aws ec2 create-image --instance-id <id> --name <newimagename>
- Update spotImage in bookpipeline/cloudsettings.go
+
+---
+
+To create a fresh rudpad image is very similar to the above:
+
+- Find the latest Debian AMI ID by finding the latest one from here: https://wiki.debian.org/Cloud/AmazonEC2Image/Buster in the output from:
+ aws ec2 describe-images --owner 136693071363
+
+- Create a new instance with the AMI id:
+ aws ec2 run-instances --image-id <imageid> --instance-type t2.micro --security-groups launch-wizard-1 --key-name awsdev2 --iam-instance-profile Name=rudpadder
+
+- Get public IP address of the instance once it is running:
+ lspipeline -nobooks
+
+- Update the ansible_host variable with the public IP of the new instance:
+ host_vars/rudpadami
+
+- Run ansible:
+ ansible-playbook -i hosts rudpad.yml
+
+- Get names of old images for reference:
+ aws ec2 describe-images --owners self
+
+- Create image:
+ aws ec2 create-image --instance-id <id> --name <newimagename>
+
+- Run a fresh instance using the image:
+ aws ec2 run-instances --image-id ami-00233dea4b2982690 --instance-type t2.micro --security-groups launch-wizard-1 --key-name awsdev2 --iam-instance-profile Name=rudpadder --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=rudpad}]'
diff --git a/host_vars/rudpadami b/host_vars/rudpadami
new file mode 100644
index 0000000..582dae6
--- /dev/null
+++ b/host_vars/rudpadami
@@ -0,0 +1,4 @@
+---
+ansible_host: 18.130.224.87
+ansible_user: admin
+ansible_ssh_private_key_file: ~/rescribe/aws/awsdev2.pem
diff --git a/hosts b/hosts
index 87d6b9f..d9754d0 100644
--- a/hosts
+++ b/hosts
@@ -1,2 +1,3 @@
[servers]
pipelineami
+rudpadami
diff --git a/roles/rudpad/tasks/main.yml b/roles/rudpad/tasks/main.yml
new file mode 100644
index 0000000..eb26d81
--- /dev/null
+++ b/roles/rudpad/tasks/main.yml
@@ -0,0 +1,82 @@
+---
+
+- name: Update apt
+ apt:
+ update_cache: yes
+
+- name: Install packages
+ apt:
+ state: present
+ name:
+ - gcc
+ - git
+ - imagemagick
+ - libssl-dev # needed for getxbook
+ - make
+ - poppler-utils # for pdfimages
+
+- name: Download Go
+ get_url:
+ url: https://golang.org/dl/go1.17.linux-amd64.tar.gz
+ dest: /home/{{ ansible_user }}
+ become: no
+
+- name: Install Go
+ unarchive:
+ dest: /usr/local
+ src: /home/{{ ansible_user }}/go1.17.linux-amd64.tar.gz
+ remote_src: true
+
+- name: Add Go tool path to path
+ lineinfile:
+ path: /home/{{ ansible_user }}/.profile
+ line: PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
+
+- name: Get go repos
+ git:
+ dest: /home/{{ ansible_user }}/src/{{ item }}
+ repo: https://git.rescribe.xyz/{{ item }}
+ force: yes
+ become: no
+ with_items:
+ - bookpipeline
+ - preproc
+ - utils
+
+- name: Download necessary parts for rescribe building
+ command:
+ cmd: /usr/local/go/bin/go generate
+ chdir: /home/{{ ansible_user }}/src/bookpipeline/cmd/rescribe
+ become: no
+ environment:
+ PATH: /usr/local/go/bin
+
+- name: Get and build go repos
+ command:
+ cmd: /usr/local/go/bin/go install ./...
+ chdir: /home/{{ ansible_user }}/src/bookpipeline
+ become: no
+ with_items:
+ - bookpipeline
+ - preproc
+ - utils
+
+- name: Get getxbook
+ git:
+ dest: /home/{{ ansible_user }}/src/getxbook
+ repo: https://git.njw.name/getxbook.git
+ force: yes
+ become: no
+
+- name: Build getxbook
+ make:
+ chdir: /home/{{ ansible_user }}/src/getxbook
+ target: all
+ become: no
+
+- name: Install getxbook
+ make:
+ chdir: /home/{{ ansible_user }}/src/getxbook
+ target: install
+ params:
+ PREFIX: /home/{{ ansible_user }}/.local
diff --git a/roles/server/tasks/update.yml b/roles/server/tasks/update.yml
index 7a9b941..a5b0c84 100644
--- a/roles/server/tasks/update.yml
+++ b/roles/server/tasks/update.yml
@@ -1,5 +1,9 @@
---
# Updates the image
+- name: Update apt
+ apt:
+ update_cache: yes
+
- name: Update all packages
package: name=* state=latest force_apt_get=yes
diff --git a/rudpad.yml b/rudpad.yml
new file mode 100644
index 0000000..42621e5
--- /dev/null
+++ b/rudpad.yml
@@ -0,0 +1,9 @@
+---
+
+- name: Configure rudpad servers
+ hosts: rudpadami
+ become: yes
+
+ roles:
+ - server
+ - rudpad