-
Notifications
You must be signed in to change notification settings - Fork 0
Add KUI tasks #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ccoulombe
wants to merge
9
commits into
main
Choose a base branch
from
kui-playbook
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add KUI tasks #273
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
007da52
Added KUI role for initial setup
ccoulombe b03a807
Fixed role in all.yml
ccoulombe ba39833
Fixed kui role for keyring and user
ccoulombe 2e8fa0c
Only run it on prod
ccoulombe 580605b
Ensure we insert at the right place
ccoulombe 13e3278
Run at 1am
ccoulombe f43f7d9
Apease linter with spaces
ccoulombe 4af1586
Ensure gpg is present
ccoulombe 30f72f8
Add blank line for readability
ccoulombe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| user_tables: "users-ca" | ||
| jobs_table: "jobs-ca" | ||
| usage_table: "usage-ca" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| - name: Download Google Cloud SDK repository key | ||
| become: true | ||
| ansible.builtin.get_url: | ||
| url: https://packages.cloud.google.com/apt/doc/apt-key.gpg | ||
| dest: /tmp/google-cloud-apt-key.gpg | ||
| mode: "0644" | ||
|
|
||
| - name: Install GnuPG (required to create the Google Cloud SDK keyring) | ||
| become: true | ||
| ansible.builtin.apt: | ||
| name: gnupg | ||
| state: present | ||
|
|
||
| - name: Create Google Cloud SDK keyring | ||
| ansible.builtin.command: | ||
| cmd: > | ||
| gpg --dearmor | ||
| --output /usr/share/keyrings/cloud.google.gpg | ||
| /tmp/google-cloud-apt-key.gpg | ||
| args: | ||
| creates: /usr/share/keyrings/cloud.google.gpg | ||
|
|
||
| - name: Add Google Cloud SDK repository | ||
| become: true | ||
| ansible.builtin.apt_repository: | ||
| repo: >- | ||
| deb [signed-by=/usr/share/keyrings/cloud.google.gpg] | ||
| https://packages.cloud.google.com/apt cloud-sdk main | ||
| filename: google-cloud-sdk | ||
| state: present | ||
|
|
||
| - name: Install Google Cloud CLI | ||
| become: true | ||
| ansible.builtin.apt: | ||
| name: google-cloud-cli | ||
| state: present | ||
| update_cache: true | ||
|
|
||
| - name: Download KUI script | ||
| ansible.builtin.get_url: | ||
| url: https://raw.githubusercontent.com/galaxyproject/kui/4e402afbca7d418413a853561de0a5a304cc6305/kui.sh | ||
| dest: "/home/{{ ansible_user }}/kui.sh" | ||
| owner: "{{ ansible_user }}" | ||
| group: "{{ ansible_user }}" | ||
| mode: '0755' | ||
| checksum: "sha256:1f2a3c9200c99e82347759fdb954b50c47b70b215b4e2b2a1c2bd062619e1269" | ||
|
|
||
| - name: Configure KUI script variables | ||
| ansible.builtin.lineinfile: | ||
| path: "/home/{{ ansible_user }}/kui.sh" | ||
| regexp: '^{{ item.key }}=.*' | ||
| line: '{{ item.key }}="{{ item.value }}"' | ||
| loop: | ||
| - {key: 'USERS_TABLE', value: "{{ user_tables }}"} | ||
| - {key: 'JOBS_TABLE', value: "{{ jobs_table }}"} | ||
| - {key: 'USAGE_TABLE', value: "{{ usage_table }}"} | ||
|
|
||
| - name: Change Galaxy server hostname | ||
| ansible.builtin.replace: | ||
| path: "/home/{{ ansible_user }}/kui.sh" | ||
| regexp: '^galaxy_server="https://usegalaxy\.org"$' | ||
| replace: 'galaxy_server="https://{{ usegalaxy_domain }}"' | ||
|
|
||
| - name: Set Postgres environment variables | ||
| ansible.builtin.lineinfile: | ||
| path: "/home/{{ ansible_user }}/kui.sh" | ||
| regexp: '^export {{ item.key }}=' | ||
| line: 'export {{ item.key }}={{ item.value }}' | ||
| insertbefore: '^export PGDATABASE=' | ||
| loop: | ||
| - key: PGHOST | ||
| value: "{{ groups['dbservers'][0] }}" | ||
| - key: PGUSER | ||
| value: "{{ galaxy_user_name }}" | ||
| - key: PGDATABASE | ||
| value: "{{ galaxy_db_name }}" | ||
|
|
||
|
ccoulombe marked this conversation as resolved.
|
||
| - name: Ensure KUI log directory exists | ||
| ansible.builtin.file: | ||
| path: "/home/{{ ansible_user }}/kui-logs" | ||
| state: directory | ||
| owner: "{{ ansible_user }}" | ||
| group: "{{ ansible_user }}" | ||
| mode: "0755" | ||
|
|
||
| - name: Set cron job to run KUI script monthly | ||
| ansible.builtin.cron: | ||
| name: Run KUI script | ||
| day: "1" | ||
| hour: "1" | ||
| minute: "0" | ||
| user: "{{ ansible_user }}" | ||
| job: >- | ||
| bash $HOME/kui.sh 2>&1 | tee -a "$HOME/kui-logs/kui-run-$(date -d "$(date +\%Y-\%m-01) -1 day" +\%Y\%m).log" | ||
|
ccoulombe marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.