spacewalk.ansible/roles/spacewalk-customisations/tasks/debian-sync.yml

48 lines
2.3 KiB
YAML

---
- name: Install pip
yum: name=python-pip state=present
- name: Install/update python-debian
pip: name=python-debian state=latest
- name: Install git
yum: name=git state=present
- name: get sync scripts
git: repo=https://github.com/philicious/spacewalk-scripts.git dest={{spacewalk_scripts_dir}}
- name: Patch the python debian library
lineinfile: dest=/usr/lib/python2.7/site-packages/debian/debfile.py regexp='^PART_EXTS =' line="PART_EXTS = ['gz', 'bz2', 'xz', 'lzma']"
- name: Add deb base channels
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- softwarechannel_create -n {{item.name}} -l {{item.label}} -a {{item.arch}} -c sha512
ignore_errors: true
with_items: "{{spacewalk_deb_repo_info}}"
- name: Add deb child channels
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- softwarechannel_create -n {{item.name}} -p {{item.parent}} -l {{item.label}} -a {{item.arch}} -c sha512
ignore_errors: true
with_items: "{{spacewalk_child_deb_repo_info}}"
- name: Add deb activation keys
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- activationkey_create -n {{item.label}} -b {{item.label}} -d {{item.name}}
ignore_errors: true
with_items: "{{spacewalk_deb_repo_info}}"
- name: Add activation keys for deb child channels
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- activationkey_create -n {{item.label}} -b {{item.parent}} -d {{item.name}}
ignore_errors: true
with_items: "{{spacewalk_child_deb_repo_info}}"
- name: Associate child channels with activationkeys
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- activationkey_addchildchannels {{item.activationkey}} {{item.label}}
ignore_errors: true
with_items: "{{spacewalk_child_deb_repo_info}}"
- name: Get the trusted SSL certs
get_url: url=http://localhost/pub/RHN-ORG-TRUSTED-SSL-CERT dest=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT
- name: Add cron jobs for synchronizing Debian repos
cron: name="{{item.name}} repo sync" minute="0" hour="7,19" job="{{spacewalk_scripts_dir}}debianSync.py --username=admin --password={{spacewalk_admin_password}} --channel {{item.label}} --url {{item.repo_url}}"
with_items: "{{spacewalk_deb_repo_info | union(spacewalk_child_deb_repo_info)}}"