Satellite 6 Install WIP
This commit is contained in:
@@ -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 }}"
|
||||
@@ -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 }}"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -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 }}"
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -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 }}"
|
||||
Reference in New Issue
Block a user