Skip to content

Instantly share code, notes, and snippets.

@VAdamec
Created May 18, 2016 10:10
Show Gist options
  • Save VAdamec/783d883e9e18814c4254844be2ca4411 to your computer and use it in GitHub Desktop.
Save VAdamec/783d883e9e18814c4254844be2ca4411 to your computer and use it in GitHub Desktop.
Include run file for CentOS6 errata playbook
- name: Set Hipchat MSG
set_fact:
REPORTMSG: "LIVE UPDATE + ERRATA SYNC {{ timestamp.stdout }} - CENTOS Update"
COLORMSG: "green"
- name: Send notification to HipChat
include: hipchat-notification.yml
tags: notify
- name: Ensure git
yum: name=git state=present
- name: Ensure perl-Data-Dumper
yum: name=perl-Data-Dumper state=present
- name: Ensure perl-Text-Unidecode
yum: name=perl-Text-Unidecode state=present
- name: Ensure perl-XML-Simple
yum: name=perl-XML-Simple state=present
- file: path="{{ tmpdir }}" state=directory mode=0755
- name: Get errata_import script
get_url: url=https://raw.githubusercontent.com/brdude/pulp_centos_errata_import/master/errata_import.pl dest={{ tmpdir }}/errata_import.pl force=yes
register: gitclone
ignore_errors: yes
when: syncrepo|success
- debug: var=gitclone.stdout_lines
- name: Git clone failed, check state of pulp_centos_errata_import repository
debug: msg="{{ errimport.stdout }}"
when: gitclone|failed
register: checkclone
- name: Download errata
get_url: url=http://cefs.steve-meier.de/errata.latest.xml dest="{{ tmpdir }}/errata.latest.xml"
register: downloadlatest
when: checkclone|success
- name: Run errata import
shell: cd {{ tmpdir }}; perl errata_import.pl --errata=errata.latest.xml --user={{ login }} --pass={{ pass }} --include-repo={{ repo }}-{{ from_stage }}
register: errimport
when: downloadlatest|success
failed_when: "'Session certificate successfully removed' not in errimport.stdout"
- name: Apply errata output
debug: msg="{{ errimport.stdout }}"
when: gitclone|success
- name: Run publish task for CentOS Live
shell: pulp-admin --username={{ login }} --password={{ pass }} rpm repo publish run --repo-id={{ repo }}-{{ from_stage }}
register: publish
when: errimport|success
failed_when: "'Task Failed' in publish.stdout"
- debug: var=publish.stdout_lines
- name: Set Hipchat MSG
set_fact:
REPORTMSG: "LIVE UPDATE + ERRATA SYNC {{ timestamp.stdout }} - CENTOS Update finished"
COLORMSG: "green"
- name: Send finish notification to HipChat
include: hipchat-notification.yml
tags: notify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment