Satellite 6 Install WIP

This commit is contained in:
Patrick Toal
2018-11-20 10:36:24 -05:00
parent 0223705ed2
commit cc0ff049bd
48 changed files with 911 additions and 132 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
# Mac cruft
.DS_Store
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Julio Villarreal
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,85 @@
Ansible Satellite 6 Install
===========================
Role to install and do basic configuration of Red Hat Satellite 6.X.
INFORMATION
-----------
This playbook will take a while to run depending the number of repositories to
sync.
Requirements
------------
You will need ansible and all the required subscriptions for RHEL 7 and
Satellite 6.
* Disk Partitioning to support Satellite Directories. Refer to installation guide.
* DNS
* NTP
* satellite_deployment_manifest_path variable defined
* Satellite Manifest file is hosted on the Ansible Bastion or available via HTTP or FTP somewhere in the environment.
Role Variables
--------------
All variables are in files located in defaults/main.yml
Dependencies
------------
There is no role dependency for this role.
Inventory File
----------
The example of inventory file for this role is in hosts.target.
How to run the playbook
------------------------
* To run the playbook first you need to create and download the manifest:
Go to <http://rhn.redhat.com>.
- Click "Satellite"
- Click "Register a Satellite"
- Set a Name, select a version and Click "Register"
After this we are going to attach a subscription.
- Click "Attach Subscription" and select the subscription to attach and click
"Attach Selected"
After this we will download the manifest.
- Click "Download manifest"
After this copy the download file inside the /files directory on the role and
name it "satellite_manifest.zip"
** Then update the variable file in defaults/main.yml in your playbook and
set all mandatory variables for role.:
You can see example of playbook in playbook_example/config.yml
* Run the playbook, see README of example playbook
[playbook readme](./playbook_example/README.rst)
License
-------
MIT
Author Information
------------------
Julio Villarreal Pelegrino <julio@linux.com> more at: http://wwww.juliovillarreal.com
**Contributors:**
Petr Balogh - <petr.balogh@gmail.com>
Joe Pisciotta - <josephpisciott@mac.com>
Nick Poyant - <npoyant@redhat.com>
Cameron Wyatt - <cwyatt@redhat.com>

View File

@@ -0,0 +1,46 @@
---
# defaults file for juliovp01.ansible_satellite6
# Go over variables bellow and pass them in extra vars, playbook vars,
# vars_files, inventory file or whatever which overwrite these values!
# main:
# version should be double! Not string!
satellite_deployment_version: 6.2
satellite_deployment_hostname_short: "sat"
satellite_deployment_hostname_full: "define.your.fqdn"
satellite_deployment_ip_address: "127.0.0.1"
# install:
satellite_deployment_plugin_packages: []
# network:
satellite_deployment_set_network: false
satellite_deployment_net_prefix: "24"
satellite_deployment_subnet_name: "sat_subnet1"
satellite_deployment_plugin_ports: []
# registration:
satellite_deployment_rhn_user: "your_rhn_user"
satellite_deployment_rhn_password: "your_rhn_pass"
# answers:
# specify answers key: value without -- prefix. Keys you can get when you
# use satellite-installer with --help | less for easier finding
satellite_deployment_answers:
'answer': 'value'
# configure_satellite:
satellite_deployment_manifest_path: "satellite_manifest.zip"
satellite_deployment_manifest_dest_path: "/root/satellite_manifest.zip"
satellite_deployment_repositories:
- { product_name: 'Red Hat Enterprise Linux Server', name_repo: 'Red Hat Enterprise Linux 7 Server (Kickstart)', rel: '7Server', architecture: 'x86_64', state: enable}
- { product_name: 'Red Hat Enterprise Linux Server', name_repo: 'Red Hat Enterprise Linux 7 Server (RPMs)', rel: '7Server', architecture: 'x86_64', state: enable}
- { product_name: 'Red Hat Enterprise Linux Server', name_repo: 'Red Hat Enterprise Linux 7 Server - RH Common (RPMs)', rel: '7Server', architecture: 'x86_64', state: enable}
- { product_name: 'Red Hat Enterprise Linux Server', name_repo: 'Red Hat Enterprise Linux 7 Server - Optional (RPMs)', rel: '7Server', architecture: 'x86_64', state: enable}
- { product_name: 'Red Hat Enterprise Linux Server', name_repo: 'Red Hat Enterprise Linux 7 Server - Supplementary (RPMs)', rel: '7Server', architecture: 'x86_64', state: enable}
- { product_name: 'Red Hat Enterprise Linux Server', name_repo: 'Red Hat Satellite Tools {{ satellite_deployment_version }} (for RHEL 7 Server) (RPMs)', architecture: 'x86_64', state: enable}
- { product_name: 'Red Hat Enterprise Linux Server', name_repo: 'Red Hat Enterprise Linux 7 Server - Extras (RPMs)', architecture: 'x86_64', state: enable}
# configure_capsules:
satellite_deployment_puppet_env: "production"

View File

@@ -0,0 +1,2 @@
---
# handlers file for juliovp01.ansible_satellite6

View File

@@ -0,0 +1 @@
{install_date: 'Tue Nov 20 15:29:14 2018', version: null}

View File

@@ -0,0 +1,19 @@
galaxy_info:
author: Julio Villarreal
description: Role to Install Red Hat Satellite 6.X
company: your company (optional)
issue_tracker_url: http://github.com/juliovp01/ansible-satellite6-install
license: MIT
min_ansible_version: 1.6
platforms:
- name: EL
versions:
- 6
- 7
galaxy_tags:
- satellite
- redhat
- install
- configuration
- satellite6

View File

@@ -0,0 +1,49 @@
#Satellite deployment
This playbook install all dependecies required by satellite, register RHN,
install satellite, and create some basic configuration of satellite.
##Configuration
You have to specify a lot of variables for satellite-deployment role.
This playbook assumes that you set all these variables in some variable file
and its path you have to pass as parameter: ``satellite-deployment-vars``
##Parameters
- **satellite-deployment-vars**
This parameter should contains path to variable file which will describe
all related variables for your Satellite server.
For example: ./vars/brq-sat-instance.yml which is relative path from
playbook.
You can see examples in [example-vars.yml](./vars/example-vars.yml)
##Requirements
- requirements are defined in [requirements.yml](./requirements.yml)
- for instll all requirements pleas run:
``ansible-galaxy install -f -r requirements.yml -p roles/``
##Execution
- For execute playbook with whole process of deployment run:
``ansible-playbook -u root -i host.target -e
'{satellite_deployment_vars: ./vars/path_to_your_vars.yml}' ./config.yml``
- You can also only update or run specific ation with scpecify appropriate
tags:
``ansible-playbook -u root -i host.target -e
'{satellite_deployment_vars: ./vars/path_to_your_vars.yml}'
--tags=update_stallite ./config.yml``
you can also exclude some tags with ``--skip-tags`` parameter of
ansible-playbook command.
##Tags
- **firewall**: set firewall
- **install_satellite**: install satellite
- **update_satellite**: update satellite
- **satellite_deployment_repositories**: deploy repositories
- **rhn**: register rhn

View File

@@ -0,0 +1,9 @@
---
- hosts: satellite-server
roles:
- role: 'ntp'
ntp_server:
- '0.pool.ntp.org'
- role: "satellite-deployment"
vars_files:
- "{{ satellite_deployment_vars }}"

View File

@@ -0,0 +1,2 @@
[satellite]
fqdn.of.your.host satellite_deployment_version=6.2

View File

@@ -0,0 +1,7 @@
---
- src: bennojoy.ntp
name: ntp
- src: https://github.com/petr-balogh/satellite-deployment.git
# version is draft for testing before we push changes to master
version: draft
name: satellite-deployment

View File

@@ -0,0 +1,59 @@
---
# MY SATELLITE ENVIRONMENT VARIABLES
# main vars
satellite_deployment_hostname_short: "sat"
satellite_deployment_hostname_full: "sat.domain.org"
satellite_deployment_admin_username: "admin"
satellite_deployment_admin_password: "123456"
satellite_deployment_organization: "ORG"
satellite_deployment_location: "BRNO"
# network
satellite_deployment_ip_address: "10.35.184.33"
satellite_deployment_network_address: "10.35.184.32"
satellite_deployment_net_prefix: "27"
satellite_deployment_gw_address: "10.35.184.62"
satellite_deployment_net_interface: "eth1"
satellite_deployment_dhcp_interface: "{{ satellite_deployment_net_interface }}"
satellite_deployment_dns_interface: "{{ satellite_deployment_net_interface }}"
satellite_deployment_dns_forwarder: "10.35.64.1"
satellite_deployment_dns_zone: "sat.domain.com"
satellite_deployment_dns_reverse_zone: "64.35.10.in-addr.arpa"
satellite_deployment_dhcp_start: "10.35.184.34"
satellite_deployment_dhcp_end: "10.35.184.61"
#satellite_deployment_plugin_ports
# install
satellite_deployment_plugin_packages:
- "foreman-discovery-image"
# registration vars
satellite_deployment_rhn_user: "rhn_user"
satellite_deployment_rhn_password: "RhnPassW0rD"
# answers for sattelite installer
satellite_deployment_answers:
"foreman-initial-organization": "{{ satellite_deployment_organization }}"
"foreman-initial-location": "{{ satellite_deployment_location }}"
"foreman-admin-username": "{{ satellite_deployment_admin_username }}"
"foreman-admin-password": "{{ satellite_deployment_admin_password }}"
"foreman-proxy-dns": "true"
"foreman-proxy-dns-interface": "{{ satellite_deployment_dns_interface }}"
"foreman-proxy-dns-zone": "{{ satellite_deployment_dns_zone }}"
"foreman-proxy-dns-forwarders": "{{ satellite_deployment_dns_forwarder }}"
"foreman-proxy-dns-reverse": "{{ satellite_deployment_dns_reverse_zone }}"
"foreman-proxy-dhcp": "true"
"foreman-proxy-dhcp-interface": "{{ satellite_deployment_dhcp_interface }}"
"foreman-proxy-dhcp-range": "{{ satellite_deployment_dhcp_start }}
{{ satellite_deployment_dhcp_end }}"
"foreman-proxy-dhcp-gateway": "{{ satellite_deployment_gw_address }}"
"foreman-proxy-dhcp-nameservers": "{{ satellite_deployment_ip_address }}"
"foreman-proxy-tftp": "true"
"foreman-proxy-tftp-servername": "{{ satellite_deployment_hostname_full }}"
"foreman-proxy-puppetca": "true"
"capsule-puppet": "true"
# configure_satellite:
satellite_deployment_manifest_path: "http://my.local.server/sat-manifest.zip"

View File

@@ -0,0 +1,81 @@
---
#Create an Smart Proxy
- name: "Configure capsule | create an smart proxy on the organization"
become: "yes"
shell: "hammer organization add-smart-proxy --name
{{ satellite_deployment_organization }} --smart-proxy-id 1"
#Add location to the Smart Proxy
- name: "Configure capsule | add location smart proxy"
command: "hammer location add-smart-proxy --name
{{ satellite_deployment_location }} --smart-proxy-id 1"
#Create domain
- name: "Configure capsule | add domain"
become: "yes"
shell: "hammer domain create --name='{{ satellite_deployment_dns_zone }}'"
ignore_errors: "yes"
- name: "Configure capsule | add domain to organization"
become: "yes"
shell: "hammer organization add-domain --name
{{ satellite_deployment_organization }} --domain
{{ satellite_deployment_dns_zone }}"
#Create the DHCP Subnet
- name: "Configure capsule | create subnet"
become: "yes"
shell: "hammer subnet create --dhcp-id 1 --dns-id 1 --dns-primary
{{ satellite_deployment_ip_address }} --domain-ids 1
--from {{ satellite_deployment_dhcp_start }}
--to {{ satellite_deployment_dhcp_end }}
--gateway {{ satellite_deployment_gw_address }}
--mask {{ satellite_deployment_netmask }}
--name {{ satellite_deployment_subnet_name }}
--network {{ satellite_deployment_network_address }} --tftp-id 1"
#Add location to Subnet
- name: "Configure capsule | location add subnet"
become: "yes"
shell: "hammer location add-subnet
--name {{ satellite_deployment_location }}
--subnet {{ satellite_deployment_subnet_name }}"
#Associate the domain to capsule
- name: "Configure capsule | associate domain capsule"
become: "yes"
shell: "hammer domain update --dns-id 1 --id 1"
#Add Location to Domain
- name: "Configure capsule | add location domain"
become: "yes"
shell: "hammer location add-domain
--name {{ satellite_deployment_location }}
--domain {{ satellite_deployment_dns_zone }}"
#Adding the Subnet the Organization
- name: "Configure capsule | add subnet the organization"
become: "yes"
shell: "hammer organization add-subnet
--name {{ satellite_deployment_organization }}
--subnet {{ satellite_deployment_subnet_name }}"
#Add puppet environment
- name: "Configure capsule | add puppet environment"
become: "yes"
shell: "hammer organization add-environment
--name {{ satellite_deployment_organization }}
--environment {{ satellite_deployment_puppet_env }}"
#Add location to the environment
- name: "Configure capsule | location add environment"
become: "yes"
shell: "hammer location add-environment
--name {{ satellite_deployment_location }}
--environment {{ satellite_deployment_puppet_env }}"
#Add location to the organization
- name: "Configure capsule | adding location to organization"
shell: "hammer location add-organization
--name {{ satellite_deployment_location }}
--organization {{ satellite_deployment_organization }}"

View File

@@ -0,0 +1,62 @@
---
#Create Hammer directory on /root
- name: "Configure | create .hammer directory on user"
file:
path: "~/.hammer"
state: "directory"
mode: "0755"
#Copy the hammer configuration from template to the .hammer directory
- name: "Configure | set configuration for hammer from template"
template:
src: "hammer_config.yml.j2"
dest: "~/.hammer/cli_config.yml"
#Copy the manifest
- name: "Configure | copy manifest"
become: "yes"
copy:
src: "{{ satellite_deployment_manifest_path }}"
dest: "{{ satellite_deployment_manifest_dest_path }}"
when: "{{ not satellite_deployment_remote_manifest }}"
- name: "Configure | copy manifest from remote"
become: "yes"
get_url:
url: "{{ satellite_deployment_manifest_path }}"
dest: "{{ satellite_deployment_manifest_dest_path }}"
when: "{{ satellite_deployment_remote_manifest }}"
#Upload the manifest to the satellite
- name: "Configure | upload the manifest"
become: "yes"
shell: "hammer subscription upload --file
{{ satellite_deployment_manifest_dest_path }} --organization
{{ satellite_deployment_organization }}"
#Enabling repos on satellite
- name: "Configure | enable repos"
become: "yes"
shell: "hammer repository-set '{{ item.state }}' --organization
'{{ satellite_deployment_organization }}'
--product '{{ item.product_name }}' --name '{{ item.name_repo }}'
{% if item.rel is defined %} --releasever '{{ item.rel }}' {% endif %}
--basearch '{{ item.architecture}}'"
with_items: "{{ satellite_deployment_repositories }}"
ignore_errors: "yes"
tags:
- "satellite_deployment_repositories"
#Get the repos ids and sync the repos
- name: "Configure | grab repositories uuid"
shell: "hammer repository list --organization
{{ satellite_deployment_organization }} | grep yum | awk '{print $1}'"
register: "repos"
- name: "Configure | sync repos on satellite"
shell: "hammer repository synchronize --id '{{ item }}' --organization
{{ satellite_deployment_organization }}"
with_items: "{{ repos.stdout_lines }}"
register: "sync_repos_result"
retries: 3
until: "{{ sync_repos_result | success }}"

View File

@@ -0,0 +1,53 @@
---
- name: "Include firewall.yml"
include_vars: "vars/firewall.yml"
tags:
- "firewall"
#Install firewalld and enable it
- name: "Install firewalld"
become: "yes"
yum:
name: "firewalld"
state: "present"
ignore_errors: "yes"
tags:
- "firewall"
- name: "Set hostname with hostnamectl"
hostname:
name: "{{ satellite_deployment_hostname_full }}"
tags:
- "firewall"
- name: "Update /etc/hosts wiht satellite hostname"
lineinfile:
line: "{{ satellite_deployment_ip_address }}
{{ satellite_deployment_hostname_full }}
{{ satellite_deployment_hostname_short }}"
dest: "/etc/hosts"
tags:
- "firewall"
- name: "Enable Firewalld"
become: "yes"
service:
enabled: "yes"
name: "firewalld"
state: "started"
tags:
- "firewall"
#Opening firewall ports
- name: "Firewall and hostname | Opening Firewalld ports"
become: "yes"
firewalld:
permanent: "yes"
immediate: "yes"
port: "{{ item }}"
state: "enabled"
with_items: "{{ satellite_deployment_fw_ports +
satellite_deployment_plugin_ports }}"
ignore_errors: "yes"
tags:
- "firewall"

View File

@@ -0,0 +1,92 @@
---
- name: "Include answers vars"
include_vars: "vars/answers.yml"
tags:
- "install_satellite"
- "update_satellite"
# Copy the Katello answer file
- name: "Install and configure | katello answer file copy"
template:
src: "answerfile.katello-installer.yaml.j2"
dest: "/etc/katello-installer/answers.katello-installer.yaml"
tags:
- "install_satellite"
- "update_satellite"
when: "{{ satellite_deployment_version == 6.1 }}"
- name: "Install and configure | katello answer file copy"
template:
src: "answerfile.katello-installer.yaml.j2"
dest: "/etc/foreman-installer/scenarios.d/satellite-answers.yaml"
tags:
- "install_satellite"
- "update_satellite"
when: "{{ satellite_deployment_version == 6.2 }}"
- name: "Install and configure | katello answer file copy"
template:
src: "answerfile.katello-installer.yaml.j2"
dest: "/etc/satellite-installer/scenarios.d/satellite-answers.yaml"
tags:
- "install_satellite"
- "update_satellite"
when: "{{ satellite_deployment_version == 6.3 }}"
# Check if service exist for foreman
- name: "Install and configure | check if service exist"
stat:
path: "/etc/init.d/foreman"
register: "foreman_service_file"
become: "yes"
tags:
- "install_satellite"
- "update_satellite"
#Run the install of Satellite if foreman is installed
- name: "Install and configure | satellite installation"
command: "/usr/sbin/katello-installer"
when: "{{ foreman_service_file.stat.exists == True and
satellite_deployment_version == 6.1 }}"
become: "yes"
tags:
- "install_satellite"
- "update_satellite"
- name: "Update satellite-installer command"
set_fact:
satellite_deployment_installer_cmd: "{{ satellite_deployment_installer_cmd
}} --{{ item.key }}='{{ item.value }}'"
with_dict: "{{ satellite_deployment_answers }}"
when: "{{ satellite_deployment_version == 6.2 }}"
tags:
- "install_satellite"
- "update_satellite"
#Run the install of Satellite 6.2
- name: "Satellite 6.2 installation"
command: "{{ satellite_deployment_installer_cmd }}"
become: "yes"
when: "{{ foreman_service_file.stat.exists == True and
satellite_deployment_version == 6.2 }}"
tags:
- "install_satellite"
- "update_satellite"
- name: "Update satellite-installer command"
set_fact:
satellite_deployment_installer_cmd: "{{ satellite_deployment_installer_cmd
}} --{{ item.key }}='{{ item.value }}'"
with_dict: "{{ satellite_deployment_answers }}"
when: "{{ satellite_deployment_version == 6.3 }}"
tags:
- "install_satellite"
- "update_satellite"
#Run the install of Satellite 6.3
- name: "Satellite 6.3 installation"
command: "{{ satellite_deployment_installer_cmd }}"
become: "yes"
when: "{{ foreman_service_file.stat.exists == True and
satellite_deployment_version == 6.3 }}"
tags:
- "install_satellite"
- "update_satellite"

View File

@@ -0,0 +1,21 @@
---
- name: "Include install vars"
include_vars: "vars/install.yml"
tags:
- "install"
- "update_satellite"
#Install the base software
- name: "Install_software"
become: "yes"
yum:
name: "{{ item }}"
state: "latest"
with_items: "{{
satellite_deployment_packages[satellite_deployment_version | string] +
satellite_deployment_extra_packages + satellite_deployment_plugin_packages
}}"
tags:
- "install"
- "update_satellite"
- "skip_ansible_lint" # ANSIBLE0010

View File

@@ -0,0 +1,11 @@
---
- include: set_facts.yml
- include: registration.yml
- include: network.yml
when: "{{ satellite_deployment_set_network }}"
- include: firewall.yml
- include: install_software.yml
- include: install_satellite.yml
- include: configure_satellite.yml
- include: configure_capsule.yml
when: "{{ satellite_configure_capsule }}"

View File

@@ -0,0 +1,30 @@
---
- name: "Set network interface IP"
shell: "nmcli con mod {{ satellite_deployment_net_interface }}
ipv4.addresses '{{ satellite_deployment_ip_address }}/{{
satellite_deployment_net_prefix }}'"
tags:
- "set_network"
- name: "Set network interface GW"
shell: "nmcli con mod {{ satellite_deployment_net_interface }} ipv4.gateway
{{ satellite_deployment_gw_address }}"
tags:
- "set_network"
- name: "Set network interface method manual"
shell: "nmcli con mod {{ satellite_deployment_net_interface }} ipv4.method
manual"
tags:
- "set_network"
- name: "Set network interface autoconnect"
shell: "nmcli con mod {{ satellite_deployment_net_interface }}
connection.autoconnect yes"
tags:
- "set_network"
- name: "Set network interface UP"
shell: "nmcli con up {{ satellite_deployment_net_interface }}"
tags:
- "set_network"

View File

@@ -0,0 +1,56 @@
---
#Registering system with RHN.
- name: "RHN | registering system with RHN"
redhat_subscription:
state: "present"
username: "{{ satellite_deployment_rhn_user }}"
password: "{{ satellite_deployment_rhn_password }}"
consumer_name: "{{ satellite_deployment_hostname_full }}"
tags:
- "rhn"
- "skip_ansible_lint" # ANSIBLE0012
- name: "Check if Satellite is subscribed"
shell: "/usr/sbin/subscription-manager list --consumed
--matches='*Satellite*' | awk '/Pool ID/ {print $3}'"
tags:
- "rhn"
- "skip_ansible_lint" # ANSIBLE0012
register: "satellite_deployment_subscribed"
#Get the pool id for the pool that contains the Satellite product
- name: "RHN | get RHN pool id"
shell: "/usr/sbin/subscription-manager list --all --available
--matches='*Satellite*' | awk '/Pool ID/ {print $3}' | head -1"
tags:
- "rhn"
register: "satellite_deployment_pool_id_command"
ignore_errors: "yes"
when: "{{ satellite_deployment_pool_id is undefined }}"
- name: "Set pool_id fact"
set_fact:
"satellite_deployment_pool_id": "{{
satellite_deployment_pool_id_command.stdout }}"
when: "{{ satellite_deployment_pool_id is undefined }}"
#Attaching the system to the right Pool
- name: "RHN | subscribing to the right pool"
command: "/usr/sbin/subscription-manager attach
--pool={{ satellite_deployment_pool_id }}"
tags:
- "rhn"
- "skip_ansible_lint" # ANSIBLE0012
ignore_errors: "yes"
when: "{{ satellite_deployment_subscribed.stdout == '' }}"
#Enabling the repos
- name: "RHN | enabling the right repos"
command: "/usr/sbin/subscription-manager repos --disable '*' --enable
rhel-7-server-satellite-{{ satellite_deployment_version }}-rpms
--enable rhel-7-server-rpms --enable rhel-server-rhscl-7-rpms"
tags:
- "rhn"
- "skip_ansible_lint" # ANSIBLE0012

View File

@@ -0,0 +1,16 @@
---
- name: "Set remote_manifest fact"
set_fact:
"satellite_deployment_remote_manifest": "{{
'http://' in satellite_deployment_manifest_path or
'ftp://' in satellite_deployment_manifest_path }}"
- name: 'Execute command to get netmask'
shell: "ipcalc --netmask {{ satellite_deployment_ip_address }}/{{
satellite_deployment_net_prefix }} | cut -d= -f2"
register: "satellite_deployment_netmas_result"
- name: "Set netmask fact"
set_fact:
"satellite_deployment_netmask": "{{
satellite_deployment_netmas_result.stdout }}"

View File

@@ -0,0 +1,58 @@
---
certs:
generate: true
deploy: true
group: foreman
katello: true
foreman:
organizations_enabled: true
locations_enabled: true
initial_organization: "{{ satellite_deployment_organization }}"
initial_location: "{{ satellite_deployment_location }}"
custom_repo: true
configure_epel_repo: false
configure_scl_repo: false
ssl: true
server_ssl_cert: /etc/pki/katello/certs/katello-apache.crt
server_ssl_key: /etc/pki/katello/private/katello-apache.key
server_ssl_ca: /etc/pki/katello/certs/katello-default-ca.crt
server_ssl_chain: /etc/pki/katello/certs/katello-default-ca.crt
websockets_encrypt: true
websockets_ssl_key: /etc/pki/katello/private/katello-apache.key
websockets_ssl_cert: /etc/pki/katello/certs/katello-apache.crt
unattended: true
admin_username: "{{ satellite_deployment_admin_username }}"
admin_password: "{{ satellite_deployment_admin_password }}"
capsule:
register_in_foreman: true
pulp_master: true
puppet: true
puppetca: true
templates: false
tftp: true
tftp_servername: "{{ satellite_deployment_ip_address }}"
bmc: false
bmc_default_provider: ipmitool
dhcp: true
dhcp_option_domain:
- "{{ satellite_deployment_dns_zone }}"
dhcp_interface: "{{ satellite_deployment_dhcp_interface }}"
dhcp_gateway: "{{ satellite_deployment_gw_address }}"
dhcp_range: "{{ satellite_deployment_dhcp_start }} {{ satellite_deployment_dhcp_end }}"
dhcp_nameservers: "{{ satellite_deployment_ip_address }}"
dns: true
dns_zone: "{{ satellite_deployment_dns_zone }}"
dns_reverse: "{{ satellite_deployment_dns_reverse_zone }}"
dns_inteface: "{{ satellite_deployment_dns_interface }}"
dns_forwarders:
- "{{ satellite_deployment_dns_forwarder }}"
"foreman::plugin::bootdisk": true
"foreman::plugin::discovery": true
"foreman::plugin::hooks": true
"foreman::plugin::tasks": true
"foreman::plugin::chef": false
"foreman::plugin::default_hostgroup": false
"foreman::plugin::puppetdb": false
"foreman::plugin::setup": false
"foreman::plugin::templates": false
"katello::plugin::gutterball": true

View File

@@ -0,0 +1,4 @@
:foreman:
:username: {{ satellite_deployment_admin_username }}
:password: {{ satellite_deployment_admin_password }}
:request_timeout: -1

View File

@@ -0,0 +1 @@
localhost

View File

@@ -2,4 +2,4 @@
- hosts: localhost
remote_user: root
roles:
- satellite
- juliovp01.ansible_satellite6

View File

@@ -0,0 +1,5 @@
---
# check defaults/main.yml which vars you have to pass.
satellite_deployment_installer_cmd: "/usr/sbin/satellite-installer
--scenario satellite"

View File

@@ -0,0 +1,15 @@
satellite_deployment_fw_ports:
- 22/tcp
- 80/tcp
- 443/tcp
- 5646/tcp
- 5647/tcp
- 5671/tcp
- 5674/tcp
- 8140/tcp
- 9090/tcp
- 53/udp
- 53/tcp
- 67/udp
- 68/udp
- 69/udp

View File

@@ -0,0 +1,18 @@
---
satellite_deployment_packages:
"6.1":
- "katello"
"6.2":
- "satellite"
"6.3":
- "satellite"
satellite_deployment_extra_packages:
- "wget"
- "git"
- "net-tools"
- "bash-completion"
- "screen"
- "vim-*"
satellite_configure_capsule: true

View File

@@ -0,0 +1,2 @@
---
# check defaults/main.yml which vars you have to pass.

View File

@@ -1,41 +0,0 @@
Satellite 6 Install
===================
Role to install Satellite 6.x
Requirements
------------
A valid Red Hat Subscription must exist on the target host with entitlements for Red Hat Satellite.
Role Variables
--------------
TBD: 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
------------
TBD: 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
----------------
- hosts: satellite
roles:
- { role: ptoal.satellite, mode: satellite }
- hosts: capsule
roles:
- { role: ptoal.satellite, mode: capsule }
License
-------
BSD
Author Information
------------------
TBD: An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@@ -1,2 +0,0 @@
---
# defaults file for satellite

View File

@@ -1,2 +0,0 @@
---
# handlers file for satellite

View File

@@ -1,2 +0,0 @@
---
# tasks file for satellite

View File

@@ -1,2 +0,0 @@
---
# vars file for satellite

View File

@@ -0,0 +1,8 @@
---
# handlers file for toal-common
- name: Ovirt Agent Restart
service:
name: ovirt-guest-agent
state: restarted
when: ansible_virtualization_type == "RHEV"

View File

@@ -1,15 +1,15 @@
---
# Ensure that virtual guests have the guest tools installed.
- name: Guest Tools Repository
rhsm_repository:
name: rhel-7-server-rh-common-rpms
state: present
- name: Install ovirt-guest-agent on RHV Guests
yum:
name: ovirt-guest-agent
state: present
when: ansible_virtualization_type == "RHEV"
- name: ovirt-guest-agent service is running
service:
name: ovirt-guest-agent
state: running
when: ansible_virtualization_type == "RHEV"
notify: Ovirt Agent Restart

View File

@@ -1,6 +1,73 @@
# Toal Lab Site Playbook
- name: Virtual Machine setup
- name: Create VMs
hosts: vms
connection: local
gather_facts: no
vars:
# Hack to work around virtualenv python interpreter
ansible_python_interpreter: "{{ ansible_playbook_python }}"
tasks:
- name: Create Satellite VM in RHV
ovirt_vm:
name: "{{ vm_name }}"
state: running
memory: "{{ vm_memory }}"
- name: Configure Satellite Servers
hosts: satellite
become: true
roles:
- ansible-role-redhat_satellite6_installation
pre_tasks:
- name: Register to RHSM and connect to Satellite Subscription.
tags: rhsm
redhat_subscription:
state: present
auto_attach: yes
username: "{{ rhn_username }}"
password: "{{ rhn_password }}"
pool: "^Red Hat Satellite Infrastructure Subscription$"
- name: Required Satellite Repos
tags: rhsm
rhsm_repository:
name: "{{ item }}"
state: present
with_items:
- rhel-7-server-rpms
- rhel-server-rhscl-7-rpms
- rhel-7-server-satellite-6.4-rpms
- rhel-7-server-satellite-maintenance-6-rpms
- rhel-7-server-ansible-2.6-rpms
- rhel-7-server-rh-common-rpms
- name: Ensure latest versions of packages
yum:
name: "*"
state: latest
- name: Latest Version of Satellite
yum:
name: satellite
state: latest
- name: Chronyd Installed
yum:
name: chrony
state: latest
notify: Restart Chrony
- name: Latest Version of SOS
yum:
name: sos
state: latest
- name: Common Lab Machine Setup
hosts: all
become: true
roles:
- toal-common
- toal-common

13
t
View File

@@ -1,13 +0,0 @@
---
- hosts: web
name: Install the apache web service
become: yes
tasks:
- name: install apache
yum:
name: httpd
state: present
- name: start httpd
service:
name: httpd
state: started

View File

@@ -1,2 +0,0 @@
---
# handlers file for toal-common

View File

@@ -1,57 +0,0 @@
galaxy_info:
author: your name
description: your 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
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# 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.

View File

@@ -1,2 +0,0 @@
localhost