Browse Source
Merge pull request #580 from bogdando/gcs_logs
Merge pull request #580 from bogdando/gcs_logs
Upload logs to GCS after failurepull/583/head
committed by
GitHub
4 changed files with 48 additions and 56 deletions
Unified View
Diff Options
-
14.travis.yml
-
23scripts/collect-info.yaml
-
39scripts/configure-logs.yaml
-
28tests/cloud_playbooks/upload-logs-gcs.yml
@ -1,39 +0,0 @@ |
|||||
--- |
|
||||
- hosts: localhost |
|
||||
become: true |
|
||||
gather_facts: no |
|
||||
|
|
||||
vars: |
|
||||
log_path: /var/log/ansible/ |
|
||||
conf_file: /etc/ansible/ansible.cfg |
|
||||
human_readable_plugin: false |
|
||||
callback_plugin_path: /usr/share/ansible/plugins/callback |
|
||||
|
|
||||
tasks: |
|
||||
- name: LOGS | ensure log path |
|
||||
file: path="{{log_path}}" state=directory owner={{ansible_ssh_user}} |
|
||||
|
|
||||
- name: LOGS | ensure plugin path |
|
||||
file: path="{{callback_plugin_path}}" state=directory owner={{ansible_ssh_user}} |
|
||||
when: human_readable_plugin |
|
||||
|
|
||||
- name: LOGS | get plugin |
|
||||
git: repo=https://gist.github.com/cd706de198c85a8255f6.git dest=/tmp/cd706de198c85a8255f6 |
|
||||
when: human_readable_plugin |
|
||||
|
|
||||
- name: LOGS | install plugin |
|
||||
copy: src=/tmp/cd706de198c85a8255f6/human_log.py dest="{{callback_plugin_path}}" |
|
||||
when: human_readable_plugin |
|
||||
|
|
||||
- name: LOGS | config |
|
||||
lineinfile: |
|
||||
line: "log_path={{log_path}}/ansible.log" |
|
||||
regexp: "^#log_path|^log_path" |
|
||||
dest: "{{conf_file}}" |
|
||||
|
|
||||
- name: LOGS | callback plugin |
|
||||
lineinfile: |
|
||||
line: "callback_plugins={{callback_plugin_path}}" |
|
||||
regexp: "^#callback_plugins|^callback_plugins" |
|
||||
dest: "{{conf_file}}" |
|
||||
when: human_readable_plugin |
|
@ -0,0 +1,28 @@ |
|||||
|
--- |
||||
|
- hosts: localhost |
||||
|
become: false |
||||
|
gather_facts: no |
||||
|
|
||||
|
vars: |
||||
|
expire: 72000 |
||||
|
|
||||
|
tasks: |
||||
|
- name: replace_test_id |
||||
|
set_fact: |
||||
|
test_name: "{{ test_id | regex_replace('\\.', '-') }}" |
||||
|
|
||||
|
- name: Create a bucket |
||||
|
gc_storage: |
||||
|
bucket: "{{ test_name }}" |
||||
|
mode: create |
||||
|
expiration: "{{ expire }}" |
||||
|
permission: private |
||||
|
|
||||
|
- name: Upload collected diagnostic info |
||||
|
gc_storage: |
||||
|
bucket: "{{ test_name }}" |
||||
|
mode: put |
||||
|
permission: private |
||||
|
expiration: "{{ expire }}" |
||||
|
object: "build-{{ test_name }}-{{ kube_network_plugin }}-logs.tar.gz" |
||||
|
src: logs.tar.gz |
Write
Preview
Loading…
Cancel
Save