UNCLASSIFIED

Commit f40faba4 authored by Michael Holmes's avatar Michael Holmes
Browse files

initial commit

parent 3e4d3b39
# 3rd_party_repos_satellite Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for 3rd_party_repos_satellite
foreman_initial_organization: "{{ lookup('env','FOREMAN_INITIAL_ORGANIZATION') }}"
foreman_initial_location: "{{ lookup('env','FOREMAN_INITIAL_LOCATION') }}"
----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
mQINBFKuaIQBEAC1UphXwMqCAarPUH/ZsOFslabeTVO2pDk5YnO96f+rgZB7xArB
OSeQk7B90iqSJ85/c72OAn4OXYvT63gfCeXpJs5M7emXkPsNQWWSju99lW+AqSNm
jYWhmRlLRGl0OO7gIwj776dIXvcMNFlzSPj00N2xAqjMbjlnV2n2abAE5gq6VpqP
vFXVyfrVa/ualogDVmf6h2t4Rdpifq8qTHsHFU3xpCz+T6/dGWKGQ42ZQfTaLnDM
jToAsmY0AyevkIbX6iZVtzGvanYpPcWW4X0RDPcpqfFNZk643xI4lsZ+Y2Er9Yu5
S/8x0ly+tmmIokaE0wwbdUu740YTZjCesroYWiRg5zuQ2xfKxJoV5E+Eh+tYwGDJ
n6HfWhRgnudRRwvuJ45ztYV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Ege9HT3N
=2KjF
-----END PGP PUBLIC KEY BLOCK-----
---
# handlers file for 3rd_party_repos_satellite
\ No newline at end of file
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.9
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
\ No newline at end of file
---
- name: grep gitlab runner to gitlab activation key
shell: hammer subscription list --organization-id 1 | grep gitlab | awk -F "|" '{print $1}'
register: subscription_gitlab
- name: add gitlab runner repo to gitlab runner key
command: hammer activation-key add-subscription --subscription-id {{ item }} --organization-id 1 --name gitlab_runner_key
register: cmd
failed_when: cmd.rc not in [128,0]
with_items:
- "{{ subscription_gitlab.stdout_lines }} "
- name: grep epel to ansible product view key
shell: hammer subscription list --organization-id 1 | grep epel | awk -F "|" '{print $1}'
register: subscription_epel
- name: add epel to ansible product view key
command: hammer activation-key add-subscription --subscription-id {{ item }} --organization-id 1 --name ansible_tower
register: cmd
failed_when: cmd.rc not in [128,0]
with_items:
- "{{ subscription_epel.stdout_lines }} "
- name: refresh activation keys
shell: hammer activation-key update --name {{ item }} --organization-id 1
loop:
- ansible_tower
- gitlab_runner_key
---
- name: move gpg keys to server, create custom repos and sync them
include_tasks: repo_create.yml
- name: add custom repos to activation keys
include_tasks: custom_content.yml
---
- name: Move epel key
copy:
src: files/rpm_gpg_key_gitlab
dest: /opt/rpm_gpg_key_gitlab
owner: root
group: root
- name: Move epel key
copy:
src: files/rpm_gpg_key_epel_7
dest: /opt/rpm_gpg_key_epel_7
owner: root
group: root
- name: Check to see if localhost is running satellite
shell: command -v hammer >/dev/null 2>&1
register: is_hammer_exist
- name: epel key create
command: hammer gpg create --key "{{ rpm_gpg_key_epel_7 }}" --organization "{{ foreman_initial_organization }}" --name "epel_7_key"
register: cmd
failed_when: cmd.rc not in [65,0]
- name: product create EPEL
command: hammer product create --gpg-key "epel_7_key" --name "epel_7_product" --description "EPEL 7 Repository" --organization "{{ foreman_initial_organization }}"
register: cmd
failed_when: cmd.rc not in [65,0]
- name: repo create epel
command: hammer repository create --organization "{{ foreman_initial_organization }}" --content-type yum --download-policy "immediate" --gpg-key "epel_7_key" --name "epel_7_repo" --product "epel_7_product" --url "https://dl.fedoraproject.org/pub/epel/7/x86_64/"
register: cmd
failed_when: cmd.rc not in [65,0]
- name: sync epel repo
command: hammer repository synchronize --organization "{{ foreman_initial_organization }}" --product epel_7_product
register: cmd
failed_when: cmd.rc not in [65,0]
- name: gitlab key create
command: hammer gpg create --key "{{ rpm_gpg_key_gitlab }}" --organization "{{ org.name }}" --name "gitlab_key"
register: cmd
failed_when: cmd.rc not in [65,0]
- name: product create gitlabrunner
command: hammer product create --gpg-key "gitlab_key" --name "gitlab_product" --description "Gitlabrunner repository" --organization "{{ org.name }}"
register: cmd
failed_when: cmd.rc not in [65,0]
- name: repo create gitlab
command: hammer repository create --organization "{{ org.name }}" --content-type yum --download-policy "immediate" --gpg-key "gitlab_key" --name "gitlab_repo" --product "gitlab_product" --url "https://packages.gitlab.com/runner/gitlab-runner/el/7/x86_64"
register: cmd
failed_when: cmd.rc not in [65,0]
- name: sync epel repo
command: hammer repository synchronize --organization "{{ foreman_initial_organization }}" --product gitlab_product
register: cmd
failed_when: cmd.rc not in [65,0]
---
- hosts: localhost
remote_user: root
roles:
- 3rd_party_repos_satellite
\ No newline at end of file
---
# vars file for 3rd_party_repos_satellite
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment