Skip to content

Instantly share code, notes, and snippets.

@gregswift
Created December 3, 2015 21:23
Show Gist options
  • Save gregswift/24ad34226c00c3b2324e to your computer and use it in GitHub Desktop.
Save gregswift/24ad34226c00c3b2324e to your computer and use it in GitHub Desktop.
vars:
organization:
name: My Organization
label: my_organization
locations:
- dc1
- dc2
katello_products:
- CentOS:
sync_plan: Weekly
gpgkeys:
- name: CentOS-6
url: http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
- name: CentOS-7
url: http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
repositories:
- name: el6-64-os
url: http://mirror.rackspace.com/centos/6/os/x86_64/
gpgkey: CentOS-6
- name: el6-64-extras
url: http://mirror.rackspace.com/centos/6/extras/x86_64/
gpgkey: CentOS-6
- name: el6-64-fasttrack
url: http://mirror.rackspace.com/centos/6/fasttrack/x86_64/
gpgkey: CentOS-6
- name: el6-64-updates
url: http://mirror.rackspace.com/centos/6/updates/x86_64/
gpgkey: CentOS-6
- name: el7-64-os
url: http://mirror.rackspace.com/centos/7/os/x86_64/
gpgkey: CentOS-7
- name: el7-64-extras
url: http://mirror.rackspace.com/centos/7/extras/x86_64/
gpgkey: CentOS-7
- name: el7-64-fasttrack
url: http://mirror.rackspace.com/centos/7/fasttrack/x86_64/
gpgkey: CentOS-7
- name: el7-64-updates
url: http://mirror.rackspace.com/centos/7/updates/x86_64/
gpgkey: CentOS-7
- Puppet:
sync_plan: Weekly
gpgkeys:
- name: PuppetLabs
url: https://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
repositories:
- name: el6-64-products
url: http://yum.puppetlabs.com/el/6Server/products/x86_64/
gpgkey: PuppetLabs
- name: el6-64-dependencies
url: http://yum.puppetlabs.com/el/6Server/dependencies/x86_64/
gpgkey: PuppetLabs
- name: el7-64-products
url: http://yum.puppetlabs.com/el/7Server/products/x86_64/
gpgkey: PuppetLabs
- name: el7-64-dependencies
url: http://yum.puppetlabs.com/el/7Server/dependencies/x86_64/
gpgkey: PuppetLabs
- EPEL:
sync_plan: Weekly
gpgkeys:
- name: EPEL-6
url: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
- name: EPEL-7
url: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
repositories:
- name: EPEL-6
url: http://mirror.rackspace.com/epel/6/x86_64/
gpgkey: EPEL-6
- name: EPEL-7
url: http://mirror.rackspace.com/epel/7/x86_64/
gpgkey: EPEL-7
- nginx:
sync_plan: Weekly
gpgkeys:
- name: nginx
url: http://nginx.org/keys/nginx_signing.key
repositories:
- name: el6-64
url: http://nginx.org/packages/centos/6/x86_64/
gpgkey: nginx
- name: el7-64
url: http://nginx.org/packages/centos/7/x86_64/
gpgkey: nginx
- Jenkins:
sync_plan: Weekly
gpgkeys:
- name: JenkinsCI
url: http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
repositories:
- name: el-noarch
url: http://pkg.jenkins-ci.org/redhat-stable/
gpgkey: JenkinsCI
- Repose:
sync_plan: Weekly
gpgkeys:
- name: OpenRepose
url: http://repo.openrepose.org/el/RPM_GPG_KEY-openrepose
repositories:
- SubscriptionManager:
sync_plan: Weekly
gpgkeys:
- name: SubscriptionManager
url: https://copr-be.cloud.fedoraproject.org/results/dgoodwin/subscription-manager/pubkey.gpg
repositories:
- name: el6-64
url: https://copr-be.cloud.fedoraproject.org/results/dgoodwin/subscription-manager/epel-6-x86_64/
gpgkey: SubscriptionManager
- Katello-Server:
sync_plan: Weekly
gpgkeys:
- name: Katello2015
url: http://www.katello.org/gpg/RPM-GPG-KEY-katello-2015.gpg
repositories:
- name: el6-64-2_3
url: http://fedorapeople.org/groups/katello/releases/yum/2.3/katello/RHEL/6Server/x86_64/
gpgkey: Katello2015
- name: el7-64-2_3
url: http://fedorapeople.org/groups/katello/releases/yum/2.3/katello/RHEL/7Server/x86_64/
gpgkey: Katello2015
- Katello-Agent:
sync_plan: Weekly
gpgkeys:
- name: Katello2015
url: http://www.katello.org/gpg/RPM-GPG-KEY-katello-2015.gpg
repositories:
- name: el6-64-2_3
url: http://fedorapeople.org/groups/katello/releases/yum/2.3/client/RHEL/6Server/x86_64/
gpgkey: Katello2015
- name: el7-64-2_3
url: http://fedorapeople.org/groups/katello/releases/yum/2.3/client/RHEL/7Server/x86_64/
gpgkey: Katello2015
- Foreman:
sync_plan: Weekly
gpgkeys:
- name: Foreman1_9
url: http://yum.theforeman.org/releases/1.9/RPM-GPG-KEY-foreman
repositories:
- name: el6-64-1_9
url: http://yum.theforeman.org/releases/1.9/el6/x86_64/
gpgkey: Foreman1_9
- name: el7-64-1_9
url: http://yum.theforeman.org/releases/1.9/el7/x86_64/
gpgkey: Foreman1_9
tasks:
- name: Add organizations
katello_organization:
state: present
name: {{ organization.name }}
label: {{ organization.label }}
- name: Remove default organization
katello_organization:
state: absent
name: Default Organization
- name: Add locations
katello_location:
state: present
name: "{{ item }}"
organization_name: {{ organization.name }}
with_items: organization.locations
- name: Configure Katello auth-source
katello_authsource:
state: present
name: rax
type: ldap
host: auth.edir.rackspace.com
port: 636
tls: true
base_dn: ou=Users,o=rackspace
groups_base: ou=POSIXGroups,o=rackspace
attr_firstname: givenName
attr_lastname: sn
attr_login: uid
attr_mail: mail
usergroup-sync: true
onthefly_register: true
- name: Create group
katello_usergroup:
state: present
name: admin
roles: {{item}}
with_items:
- Manager
- Viewer
- View hosts
- Edit hosts
- Edit partition tables
- Tasks Manager
- Tasks Reader
- name: Map external groups to katello group
katello_usergroup:
state: present
name: admin
external_group: {{item}}
with_items:
- lnx-cloud-cit-engineer
- lnx-cloud-cit-admins
- name: Create a sync plan
katello_syncplan:
state: present
name: Weekly
enabled: true
interval: weekly
organization_name: {{ organization.name }}
sync_date: "2015-07-25 00:00:00" #Defaults to now
# This task would likely work better as a role
- name: import gpg keys for CentOS
katello_gpgkey:
state: present
name: {{ item.name }}
source_url: {{ item.url }}
organization_name: {{ organization.name }}
with_items: katello_products.CentOS.gpgkeys
- name: import gpg keys for PuppetLabs
katello_gpgkey:
state: present
name: {{ item.name }}
source_url: {{ item.url }}
organization_name: {{ organization.name }}
with_items: katello_products.Puppet.gpgkeys
- name: Create all the products
katello_product:
state: present
name: {{ item.key }}
sync_plan: {{ item.value.sync_plan }}
organization_name: {{ organization.name }}
with_dict: katello_products
# This task would likely work better as a role
- name: Create all the repositories for CentOS
katello_repository:
state: present
name: {{ item.name }}
url: {{ item.url }}
gpgkey: {{ item.gpgkey | default(omit) }}
content-type: {{ item.content_type | default('yum') }}
product: CentOS
publish_via_http: {{ item.publish_via_http | default(true) }}
organization_name: {{ organization.name }}
with_items: katello_products.CentOS.repositories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment