diff --git a/defaults/main.yml b/defaults/main.yml index 285f0e4..e4f8e9a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,12 @@ --- -# defaults file for . \ No newline at end of file +# defaults file for . +cat_user: cat +cat_homedir: cat + +cat_postgres_db: cat +cat_postgres_user: cat_user + +# sensitive info +cat_postgres_password: "{{ vault_cat_postgres_password }}" + +cat_git_destination: /home/{{ cat_user }}/cat_src diff --git a/handlers/main.yml b/handlers/main.yml deleted file mode 100644 index efcd588..0000000 --- a/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for . \ No newline at end of file diff --git a/logo/cat_wrench.png b/logo/cat_wrench.png new file mode 100644 index 0000000..a3a3bbc Binary files /dev/null and b/logo/cat_wrench.png differ diff --git a/logo/cat_wrench.svg b/logo/cat_wrench.svg new file mode 100644 index 0000000..c85d9fd --- /dev/null +++ b/logo/cat_wrench.svg @@ -0,0 +1,141 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/meta/main.yml b/meta/main.yml index 5d50bf4..75f2452 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,6 @@ galaxy_info: - author: your name - description: your description + author: Maxime Bloch + description: deployment/update role for the cat application company: your company (optional) # If the issue tracker for your role is not on github, uncomment the @@ -14,7 +14,7 @@ galaxy_info: # - GPLv3 # - Apache # - CC-BY - license: license (GPLv2, CC-BY, etc) + license: MIT min_ansible_version: 2.4 @@ -57,4 +57,4 @@ galaxy_info: dependencies: [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. \ No newline at end of file + # if you add dependencies to this list. diff --git a/tasks/main.yml b/tasks/main.yml index c9ad62f..3fb576e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,79 @@ --- -# tasks file for . \ No newline at end of file +# tasks file for . + +######## +# User # +######## + +- name: Create cat user + user: + name: "{{ cat_user }}" + + + +############ +# Database # +############ + +- name: Install psql + apt: + name: "{{ packages }}" + vars: + packages: + - psycopg2 + - postgres-9.6 + +- name: Create database + become: yes + become_user: postgres + postgresql_db: + name: "{{ cat_postgres_db }}" + +- name: Create database user + become: yes + become_user: postgres + postgresql_user: + db: "{{ cat_postgres_db }}" + name: "{{ cat_postgres_user }}" + password: "{{ cat_postgres_password }}" + +- name: Clone cat repo + repo: ssh://git@git.zeus.gent:2222/ZeusWPI/cat.git + dest: "{{ cat_git_destination }}" + accept_hostkey: yes + +################################## +# Download and install leiningen # +################################## + +- name: Make sure java is installed + apt: + name: java + +- name: set user bin dir + set_fact: + user_bin_dir: /usr/bin + +- name: Download leiningen + get_url: + url: https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein + dest: "{{ user_bin_dir }}" + +- name: Add executable permission for lein script + file: + path: "{{ user_bin_dir }}/lein" + mode: "a+x" + +################### +# Compile and run # +################### + +- name: Compile to jar + shell: lein uberjar + args: + chdir: "{{ cat_git_destination }}" + +- name: Run jar + shell: java -jar {{cat_git_destination }}/target/uberjar/cat.jar + environment: + DATABASE_URL: "postgresql://localhost:5432/{{ cat_postgres_db }}?user={{ cat_postgres_user }}&password={{ cat_postgres_password }}" diff --git a/vars/main.yml b/vars/main.yml deleted file mode 100644 index b9f336c..0000000 --- a/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for . \ No newline at end of file