ansible/configs/satellite-multi-region/README.adoc
@@ -17,8 +17,8 @@ Following are the requirements: . Yum repositories are required for bastion and satellite host. . Aws credentials are required. . Aws credentials are required. Config Variables ---------------- @@ -63,12 +63,12 @@ |lifecycle_environment_path: [list] |Required | Contains nested list of environment path |satellite_content: [list] |Required | Main List variable |subscription_name: "String" |Required | Subscription name mainly required for manifest role | manifest_file: "/path/to/manifest.zip" |Required | Path of download satellite manifest |satellite_manifest: {Dictionary} |Required | Where satellite manifest is stored |=== [NOTE] [NOTE] For more about variables read README.adoc of the roles. * Example variables . Sample of sample_vars.yml @@ -78,10 +78,10 @@ [user@desktop ~]$ cat ./configs/satellite-multi-region/sample_vars.yml env_type: satellite-multi-region output_dir: /tmp/workdir email: satellite_multi_region@example.com cloud_provider: ec2 env_type: satellite-multi-region output_dir: /tmp/workdir email: satellite_multi_region@example.com cloud_provider: ec2 target_regions: - region: ap-southeast-2 @@ -96,7 +96,7 @@ subnet_cidr: 10.2.0.0/24 install_satellite: True configure_satellite: True configure_satellite: True install_capsule: True configure_capsule: True satellite_version: 6.4 @@ -127,14 +127,14 @@ life_cycle: "Library" content_view: "Capsule Content" content_view_update: False repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' basearch: 'x86_64' releasever: '7Server' - name: 'Red Hat Satellite Capsule 6.4 (for RHEL 7 Server) (RPMs)' product: 'Red Hat Satellite Capsule' product: 'Red Hat Satellite Capsule' basearch: 'x86_64' - name: "Three Tier App" activation_key: "three_tier_app_key" @@ -142,14 +142,14 @@ life_cycle: "Library" subscriptions: - "Employee SKU" repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' basearch: 'x86_64' releasever: '7Server' releasever: '7Server' ---- for reference look at link:sample_vars.yml[] for reference look at link:sample_vars.yml[] . Sample of secrets.yml @@ -178,16 +178,15 @@ |=== |*Role*| *Link* | *Description* |satellite-public-hostname | link:../../roles/satellite-public-hostname[satellite-public-hostname] | Set public hostname |satellite-installation |link:../../roles/satellite-installation[satellite-installation] | Install and configure satellite |satellite-installation |link:../../roles/satellite-installation[satellite-installation] | Install and configure satellite |satellite-hammer-cli |link:../../roles/satellite-hammer-cli[satellite-hammer-cli] | Setup hammer cli |satellite-manage-organization |link:../../roles/satellite-manage-organization[satellite-manage-organization] | Create satellite organization |satellite-manage-manifest |link:../../roles/ssatellite-manage-manifest[satellite-manage-manifest] | uploads manifest |satellite-manage-subscription |link:../../roles/satellite-manage-subscription[satellite-manage-subscription] | Manage subscription/repository |satellite-manage-sync |link:../../roles/satellite-manage-sync[satellite-manage-sync] | Synchronize repository |satellite-manage-repositories |link:../../roles/satellite-manage-repository[satellite-manage-repositories] | Manage subscriptions/repositories and synchronize |satellite-manage-lifecycle |link:../../roles/satellite-manage-lifecycle[satellite-manage-lifecycle] | Create lifecycle environment |satellite-manage-content-view |link:../../roles/satellite-manage-content-view[satellite-manage-content-view] | Create content-view |satellite-manage-activationkey |link:../../roles/satellite-manage-activationkey[satellite-manage-content-view] | Create activation key |satellite-manage-capsule-certificate | link:../../roles/satellite-manage-capsule-certificate[satellite-manage-capsule-certificate] | Create certificates for capsule installation on satellite |satellite-manage-capsule-certificate | link:../../roles/satellite-manage-capsule-certificate[satellite-manage-capsule-certificate] | Create certificates for capsule installation on satellite |satellite-capsule-installation |link:../../roles/satellite-capsule-installation[satellite-capsule-installation] | Install capsule packages |satellite-capsule-configuration | link:../../roles/satellite-capsule-configuration[satellite-capsule-configuration] | Setup capsule server |=== @@ -212,25 +211,31 @@ ansible-playbook playbook.yml --skip-tags install_satellite,install_capsule ---- Example to run config Example to run config --------------------- How to use config (for instance, with variables passed in playbook). [source=text] ---- [user@desktop ~]$ cat ~/satellite_vars.yml --- guid: 'defaultguid' satellite_admin: admin satellite_admin_password: 'changeme' satellite_manifest: type: 'file' path: '/path/to/manifest_satellite_6.4.zip' [user@desktop ~]$ cd agnosticd/ansible [user@desktop ~]$ ansible-playbook main.yml \ -e @./configs/satellite-multi-region/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid \ -e satellite_admin=admin \ -e 'satellite_admin_password=password' \ -e manifest_file=/path/to/manifest_satellite_6.4.zip -e @~/satellite_vars.yml ---- Example to stop environment Example to stop environment --------------------------- [source=text] @@ -240,10 +245,10 @@ [user@desktop ~]$ ansible-playbook ./configs/satellite-multi-region/stop.yml \ -e @./configs/satellite-multi-region/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid -e guid=defaultguid ---- Example to start environment Example to start environment --------------------------- [source=text] @@ -253,10 +258,10 @@ [user@desktop ~]$ ansible-playbook ./configs/satellite-multi-region/start.yml \ -e @./configs/satellite-multi-region/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid -e guid=defaultguid ---- Example to destroy environment Example to destroy environment ------------------------------ [source=text] @@ -266,7 +271,7 @@ [user@desktop ~]$ ansible-playbook ./configs/satellite-multi-region/destroy_env.yml \ -e @./configs/satellite-multi-region/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid -e guid=defaultguid ---- ansible/configs/satellite-multi-region/software.yml
@@ -33,8 +33,7 @@ loop: - satellite-manage-organization - satellite-manage-manifest - satellite-manage-subscription - satellite-manage-sync - satellite-manage-repositories # - satellite-manage-lifecycle # - satellite-manage-content-view # - satellite-manage-activationkey ansible/configs/satellite-vm/README.adoc
@@ -17,8 +17,8 @@ Following are the requirements: . Yum repositories are required for bastion and satellite host. . Aws credentials are required. . Aws credentials are required. Config Variables ---------------- @@ -49,12 +49,12 @@ |lifecycle_environment_path: [list] |Required | Contains nested list of environment path |satellite_content: [list] |Required | Main List variable |subscription_name: "String" |Required | Subscription name mainly required for manifest role | manifest_file: "/path/to/manifest.zip" |Required | Path of download satellite manifest | satellite_manifest: {Dictionary} |Required | Where satellite manifest is stored |=== [NOTE] [NOTE] For more about variables read README.adoc of the roles. * Example variables files . Sample of sample_vars.yml @@ -64,14 +64,14 @@ [user@desktop ~]$ cat ./configs/satellite-vm/sample_vars.yml env_type: satellite-vm output_dir: /tmp/workdir email: satellite_vm@example.com cloud_provider: ec2 env_type: satellite-vm output_dir: /tmp/workdir email: satellite_vm@example.com cloud_provider: ec2 aws_region: ap-southeast-2 install_satellite: True configure_satellite: True configure_satellite: True satellite_version: 6.4 org: gpte org_label: gpte @@ -100,14 +100,14 @@ life_cycle: "Library" content_view: "Capsule Content" content_view_update: False repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' basearch: 'x86_64' releasever: '7Server' - name: 'Red Hat Satellite Capsule 6.4 (for RHEL 7 Server) (RPMs)' product: 'Red Hat Satellite Capsule' product: 'Red Hat Satellite Capsule' basearch: 'x86_64' - name: "Three Tier App" activation_key: "three_tier_app_key" @@ -115,13 +115,13 @@ life_cycle: "Library" subscriptions: - "Employee SKU" repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' basearch: 'x86_64' releasever: '7Server' releasever: '7Server' ---- for reference look at link:sample_vars.yml[] for reference look at link:sample_vars.yml[] . Sample of secrets.yml [source=text] @@ -150,16 +150,15 @@ |=== |*Role*| *Link* | *Description* |satellite-public-hostname | link:../../roles/satellite-public-hostname[satellite-public-hostname] | Set public hostname |satellite-installation |link:../../roles/satellite-installation[satellite-installation] | Install and configure satellite |satellite-installation |link:../../roles/satellite-installation[satellite-installation] | Install and configure satellite |satellite-hammer-cli |link:../../roles/satellite-hammer-cli[satellite-hammer-cli] | Setup hammer cli |satellite-manage-organization |link:../../roles/satellite-manage-organization[satellite-manage-organization] | Create satellite organization |satellite-manage-manifest |link:../../roles/ssatellite-manage-manifest[satellite-manage-manifest] | uploads manifest |satellite-manage-subscription |link:../../roles/satellite-manage-subscription[satellite-manage-subscription] | Manage subscription/repository |satellite-manage-sync |link:../../roles/satellite-manage-sync[satellite-manage-sync] | Synchronize repository |satellite-manage-repositories |link:../../roles/satellite-manage-repository[satellite-manage-repositories] | Manage subscriptions/repositories and synchronize |satellite-manage-lifecycle |link:../../roles/satellite-manage-lifecycle[satellite-manage-lifecycle] | Create lifecycle environment |satellite-manage-content-view |link:../../roles/satellite-manage-content-view[satellite-manage-content-view] | Create content-view |satellite-manage-activationkey |link:../../roles/satellite-manage-activationkey[satellite-manage-content-view] | Create activation key |satellite-manage-capsule-certificate | link:../../roles/satellite-manage-capsule-certificate[satellite-manage-capsule-certificate] | Create certificates for capsule installation on satellite |satellite-manage-capsule-certificate | link:../../roles/satellite-manage-capsule-certificate[satellite-manage-capsule-certificate] | Create certificates for capsule installation on satellite |satellite-capsule-installation |link:../../roles/satellite-capsule-installation[satellite-capsule-installation] | Install capsule packages |satellite-capsule-configuration | link:../../roles/satellite-capsule-configuration[satellite-capsule-configuration] | Setup capsule server |=== @@ -182,25 +181,31 @@ ansible-playbook playbook.yml --skip-tags install_satellite ---- Example to run config Example to run config --------------------- How to use config (for instance, with variables passed in playbook). [source=text] ---- [user@desktop ~]$ cat ~/satellite_vars.yml --- guid: 'defaultguid' satellite_admin: admin satellite_admin_password: 'changeme' satellite_manifest: type: 'file' path: '/path/to/manifest_satellite_6.4.zip' [user@desktop ~]$ cd agnosticd/ansible [user@desktop ~]$ ansible-playbook main.yml \ -e @./configs/satellite-vm/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid \ -e satellite_admin=admin \ -e 'satellite_admin_password=changeme' \ -e manifest_file=/path/to/manifest_satellite_6.4.zip -e @~/satellite_vars.yml ---- Example to stop environment Example to stop environment --------------------------- [source=text] @@ -210,10 +215,10 @@ [user@desktop ~]$ ansible-playbook ./configs/satellite-vm/stop.yml \ -e @./configs/satellite-vm/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid -e guid=defaultguid ---- Example to start environment Example to start environment --------------------------- [source=text] @@ -223,10 +228,10 @@ [user@desktop ~]$ ansible-playbook ./configs/satellite-vm/start.yml \ -e @./configs/satellite-vm/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid -e guid=defaultguid ---- Example to destroy environment Example to destroy environment ------------------------------ [source=text] @@ -236,7 +241,7 @@ [user@desktop ~]$ ansible-playbook ./configs/satellite-vm/destroy.yml \ -e @./configs/satellite-vm/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid -e guid=defaultguid ---- ansible/configs/satellite-vm/software.yml
@@ -34,8 +34,7 @@ loop: - satellite-manage-organization - satellite-manage-manifest - satellite-manage-subscription - satellite-manage-sync - satellite-manage-repositories # - satellite-manage-lifecycle # - satellite-manage-content-view # - satellite-manage-activationkey ansible/roles/satellite-manage-manifest/README.adoc
@@ -3,7 +3,7 @@ :tag1: configure_satellite :tag2: configure_satellite_manifest :main_file: tasks/main.yml :version_file: tasks/version_6.4.yml :version_file: tasks/version_6.x.yml Role: {role} ============ @@ -16,33 +16,56 @@ Following are the requirements: . Satellite must be install and setup. . Hammer cli config must be configured/updated with privileged user and password to run the satellite cli. Role Variables -------------- * Following are the variable which needs to be defined * Following are the variable which needs to be defined [cols="4a,2a,4a"] |=== |satellite_version: "Digit" |Required |satellite version |org: "String" |Required |Organization name |org_label: "String" |Not-equired | Organization label in string without space |org_description: "String" |Not-required | Organization description |subscription_name: "String" |Required |Subscription name for manifest |manifest_file: "String" |Required |Holds local path of manifest file |org_label: "String" |Optional | Organization label in string without space |org_description: "String" |Optional | Organization description |satellite_manifest: {Dictionary} [cols="1"] !=== !type: "String" !path: "String" !url: "String" !=== |Required [cols="1"] !=== !Required !Required for type !Required for 'url' !=== |Holds info to access the manifest file [cols="1"] !=== ! Type of the storage (One of 'file', 'url') ! Path to the local file ! Url for the remote file !=== |cdn_repository_url: "String"|Optional | If to sync content from another cdn than https://cdn.redhat.com/ |=== * Exammple variables [source=text] ---- satellite_version: 6.4 satellite_version: 6.7 org: "gpte" org_label: "gpte" org_description: "Global Partner Training and Enablement" subscription_name: "Employee SKU" manifest_file: /home/user/manifest.zip cdn_repository_url: "http://my.local.com/cdn" satellite_manifest: type: file path: /home/user/manifest.zip ---- Tags @@ -71,12 +94,14 @@ [source=text] ---- [user@desktop ~]$ cat sample_vars.yml satellite_version: 6.4 satellite_version: 6.7 org: "gpte" org_label: "gpte" org_description: "Global Partner Training and Enablement" subscription_name: "Employee SKU" manifest_file: /home/user/manifest.zip cdn_repository_url: "http://my.local.com/cdn" satellite_manifest: type: file path: /home/user/manifest.zip [user@desktop ~]$ cat playbook.yml @@ -92,9 +117,9 @@ Tips to update Role ------------------ To extend role works for other version, create new file named version_{{satellite_version}}.yml and import newly created file in main.yml To extend role works for other version, if necessary create new file named version_{{satellite_version}}.yml and import newly created file in main.yml for reference look at link:{main_file}[main.yml] and link:{version_file}[version_6.4.yml] for reference look at link:{main_file}[main.yml] and link:{version_file}[version_6.x.yml] Author Information ansible/roles/satellite-manage-manifest/tasks/main.yml
@@ -1,8 +1,8 @@ --- ## Import for version satellite 6.4 ## - import_tasks: version_6.4.yml when: satellite_version == 6.4 - import_tasks: version_6.x.yml when: satellite_version is version_compare('6.4', '>=') tags: - configure_satellite - configure_satellite_manifest - configure_satellite_manifest ansible/roles/satellite-manage-manifest/tasks/version_6.4.yml
File was deleted ansible/roles/satellite-manage-manifest/tasks/version_6.x.yml
New file @@ -0,0 +1,44 @@ --- - name: Set manifest_basename fact set_fact: manifest_basename: "{{ satellite_manifest.path | basename }}" when: satellite_manifest.type == 'file' - name: Copy manifest copy: src: "{{ satellite_manifest.path }}" dest: /tmp when: satellite_manifest.type == 'file' - name: Set manifest_basename fact set_fact: manifest_basename: "{{ satellite_manifest.url | basename }}" when: satellite_manifest.type == 'url' - name: Check if manifest file is uploaded stat: path: "/tmp/{{ manifest_basename }}" register: manifest_file_existance_result when: satellite_manifest.type == 'url' - name: get_url: url: "{{ satellite_manifest.url }}" dest: /tmp when: - satellite_manifest.type == 'url' - not manifest_file_existance_result.stat.exists - name: "Upload the manifest" theforeman.foreman.katello_manifest: username: "{{ satellite_admin }}" password: "{{ satellite_admin_password }}" server_url: "https://{{ publicname }}" organization: "{{ org }}" validate_certs: no manifest_path: "/tmp/{{ manifest_basename }}" repository_url: "{{ cdn_repository_url | d(omit) }}" state: present tags: - configure_satellite - configure_satellite_manifest ansible/roles/satellite-manage-repositories/README.adoc
New file @@ -0,0 +1,142 @@ :role: satellite-manage-subscription :author: GPTE Team :tag1: configure_satellite :tag2: configure_satellite_reposet :tag3: configure_satellite_sync :main_file: tasks/main.yml :version_file: tasks/version_6.x.yml Role: {role} ============ This role enables subscribed repository and synchronizes them. Requirements ------------ Following are the requirements: . Satellite must be install and setup. . Subscriptions through manifest should be available on satellite server. Role Variables -------------- * Following are the variable which needs to be defined |=== |satellite_version: "Digit" |Required |satellite version |org: "String" |Required |Organization name |org_label: "String" |Notrequired | Organization label in string without space |org_description: "String" |Not-required | Organization description |satellite_content: {Dictionary} |Required | Main dictionary variable |repos: [list] | Required | List of repository name |product: "String" |Required | Product name of repository |name: "String" |Required | Repository Name |basearch: "String" |Wherever Applicable | Repository Base Arch |releasever: "String" |Wherever Applicable | Repository Release version |sync: "boolean" |Optional(*yes*) | Whether sync the repository |=== * Exammple variables [source=text] ---- satellite_version: 6.7 org: "gpte" org_label: "gpte" org_description: "Global Partner Training and Enablement" satellite_content: - name: "Ansible server" repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' basearch: 'x86_64' releasever: '7Server' - name: 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)' product: 'Red Hat Enterprise Linux for x86_64' releasever: '8' sync: no - name: "Three Tier App" repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' basearch: 'x86_64' releasever: '7Server' ---- Tags --- |=== |{tag1} |Consistent tag for all satellite config roles |{tag2} |This tag is specific to this role only - repo enablement tasks |{tag3} |This tag is specific to this role only - repo sync tasks |=== * Example tags ---- ## Tagged jobs ansible-playbook playbook.yml --tags configure_satellite,configure_satellite_reposet,configure_satellite_sync ## Skip tagged jobs ansible-playbook playbook.yml --skip-tags configure_satellite,configure_satellite_reposet,configure_satellite_sync ---- Example Playbook ---------------- How to use your role (for instance, with variables passed in playbook). [source=text] ---- [user@desktop ~]$ cat sample_vars.yml satellite_version: 6.7 org: "gpte" org_label: "gpte" org_description: "Global Partner Training and Enablement" satellite_content: - name: "Ansible server" repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' basearch: 'x86_64' releasever: '7Server' - name: 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)' product: 'Red Hat Enterprise Linux for x86_64' releasever: '8' sync: no - name: "Three Tier App" repos: - name: 'Red Hat Enterprise Linux 7 Server (RPMs)' product: 'Red Hat Enterprise Linux Server' basearch: 'x86_64' releasever: '7Server' [user@desktop ~]$ cat playbook.yml - hosts: satellite.example.com vars_files: - sample_vars.yml roles: - satellite-manage-subscription [user@desktop ~]$ ansible-playbook playbook.yml ---- Tips to update Role ------------------ To extend role works for other version, create new file named version_{{satellite_version}}.yml if necessary and import newly created file in main.yml for reference look at link:{main_file}[main.yml] and link:{version_file}[version_6.x.yml] Author Information ------------------ {author} ansible/roles/satellite-manage-repositories/tasks/main.yml
New file @@ -0,0 +1,7 @@ --- ## Import for version satellite 6.4 ## - import_tasks: version_6.x.yml when: satellite_version is version_compare('6.4', '>=') tags: - configure_satellite ansible/roles/satellite-manage-repositories/tasks/version_6.x.yml
New file @@ -0,0 +1,51 @@ --- - name: Setting up satellite repository theforeman.foreman.katello_repository_set: username: "{{ satellite_admin }}" password: "{{ satellite_admin_password }}" server_url: "https://{{ publicname }}" validate_certs: no organization: "{{ org }}" name: "{{ item.1.name }}" product: "{{ item.1.product }}" repositories: - releasever: "{{ item.1.releasever | default(omit) }}" basearch: "{{ item.1.basearch | default(omit) }}" loop: "{{ satellite_content | subelements('repos') }}" tags: - configure_satellite - configure_satellite_reposet ## Sync repositories - name: Sync repository theforeman.foreman.katello_sync: username: "{{ satellite_admin }}" password: "{{ satellite_admin_password }}" server_url: "https://{{ publicname }}" validate_certs: no organization: "{{ org }}" product: "{{ item.1.product }}" repository: "{{ item.1.name | regex_replace('[()]') + (' ' + item.1.basearch if item.1.basearch|d(None) else '' ) + ( ' ' + item.1.releasever if item.1.releasever|d(None) else '' ) }}" loop: "{{ satellite_content | subelements('repos') }}" async: 999999 poll: 0 register: repo_sync_sleeper when: item.1.sync | default(True) | bool tags: - configure_satellite - configure_satellite_sync - name: Wait until all Syncs have finished async_status: jid: "{{ repo_sync_sleeper_item.ansible_job_id }}" loop: "{{ repo_sync_sleeper.results }}" loop_control: loop_var: repo_sync_sleeper_item when: repo_sync_sleeper_item.ansible_job_id is defined # Skip items that were skipped in the previous task register: async_job_result until: async_job_result.finished retries: 999 delay: 20 tags: - configure_satellite - configure_satellite_sync ansible/roles/satellite-manage-subscription/README.adoc
File was deleted ansible/roles/satellite-manage-subscription/files/subscription_script_version_6.4.sh
File was deleted ansible/roles/satellite-manage-subscription/tasks/main.yml
File was deleted ansible/roles/satellite-manage-subscription/tasks/version_6.4.yml
File was deleted ansible/roles/satellite-manage-sync/README.adoc
File was deleted ansible/roles/satellite-manage-sync/files/sync_script_version_6.4.sh
File was deleted ansible/roles/satellite-manage-sync/tasks/main.yml
File was deleted ansible/roles/satellite-manage-sync/tasks/version_6.4.yml
File was deleted