First commit for Spacewalk Ansible roles
This commit is contained in:
45
roles/spacewalk-customisations/tasks/customisations.yml
Normal file
45
roles/spacewalk-customisations/tasks/customisations.yml
Normal file
@ -0,0 +1,45 @@
|
||||
---
|
||||
- name: Install spacecmd
|
||||
yum: name=spacecmd
|
||||
|
||||
- name: Add base channels
|
||||
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- softwarechannel_create -n {{item.name}} -l {{item.label}} -a x86_64 -c sha512
|
||||
ignore_errors: true
|
||||
with_items: "{{spacewalk_repo_info}}"
|
||||
|
||||
- name: Add child channels
|
||||
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- softwarechannel_create -n {{item.name}} -p {{item.parent}} -l {{item.label}} -a x86_64 -c sha512
|
||||
ignore_errors: true
|
||||
with_items: "{{spacewalk_child_repo_info}}"
|
||||
|
||||
- name: Add Repositories
|
||||
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- repo_create -n {{item.name}} -u {{item.repo_url}}
|
||||
ignore_errors: true
|
||||
with_items: "{{ spacewalk_repo_info | union(spacewalk_child_repo_info) }}"
|
||||
|
||||
- name: Add activation keys
|
||||
command: spacecmd --user=admin --password=test123 -- activationkey_create -n {{item.label}} -b {{item.label}} -d {{item.name}}
|
||||
ignore_errors: true
|
||||
with_items: "{{spacewalk_repo_info}}"
|
||||
|
||||
- name: Add activation keys for child channels
|
||||
command: spacecmd --user=admin --password=test123 -- activationkey_create -n {{item.label}} -b {{item.parent}} -d {{item.name}}
|
||||
ignore_errors: true
|
||||
with_items: "{{spacewalk_child_repo_info}}"
|
||||
|
||||
- name: Associate repos to channels
|
||||
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- softwarechannel_addrepo {{item.label}} {{item.repo}}
|
||||
with_items: "{{ spacewalk_repo_info | union(spacewalk_child_repo_info) }}"
|
||||
|
||||
- name: Associate child channels with activationkeys
|
||||
command: spacecmd --user=admin --password=test123 -- activationkey_addchildchannels 1-{{item.label}} {{item.label}}
|
||||
ignore_errors: true
|
||||
with_items: "{{spacewalk_child_repo_info}}"
|
||||
|
||||
|
||||
- name: Set sync repo schedules
|
||||
command: spacecmd --user=admin --password={{spacewalk_admin_password}} -- softwarechannel_setsyncschedule {{item.label}} 0 30 3 ? * *
|
||||
with_items: "{{spacewalk_repo_info}}"
|
||||
|
||||
|
||||
|
27
roles/spacewalk-customisations/tasks/debian-sync.yml
Normal file
27
roles/spacewalk-customisations/tasks/debian-sync.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
- 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 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: 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}}"
|
3
roles/spacewalk-customisations/tasks/main.yml
Executable file
3
roles/spacewalk-customisations/tasks/main.yml
Executable file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- include: customisations.yml
|
||||
- include: debian-sync.yml
|
Reference in New Issue
Block a user