diff --git a/experiment/full.sh b/experiment/full.sh index 1e8358fc..513e8045 100755 --- a/experiment/full.sh +++ b/experiment/full.sh @@ -562,5 +562,31 @@ ap sosreporter-gatherer.log \ -e "sosreport_gatherer_local_dir='../../$logs/sosreport/'" \ playbooks/satellite/sosreport_gatherer.yaml +#AK Deletion +for rel in $rels; do + for lce in $lces; do + ak="AK_${rel}_${lce}" + h "100-ak-delete-${lce}.log" "activation-key delete --organization-id '{{ sat_org }}' --name '$ak' --lifecycle-environment '$lce'" + done +done + +#LCE Deletion +for lce in $lces; do + h "101-lce-delete-${lce}.log" "lifecycle-environment delete --organization-id '{{ sat_org }}' --name '$lce'" +done + +#CVV deletion +for rel in $rels; do + ccv="CCV_$rel" + h "102-ccv-delete-${rel}.log" "content-view delete --organization '{{ sat_org }}' --name '$ccv'" +done + +#Repository Deletion +for os_rid in $os_rids; do + h "103-repository-delete-${os_rid}.log" "repository delete --organization '{{ sat_org }}' --name '$os_rid'" +done + +#Product Deletion +h "104-product-delete-${os_product}.log" "product delete --organization '{{ sat_org }}' --name '$os_product'" junit_upload diff --git a/playbooks/satellite/cleanup.yaml b/playbooks/satellite/cleanup.yaml new file mode 100644 index 00000000..d421a6bd --- /dev/null +++ b/playbooks/satellite/cleanup.yaml @@ -0,0 +1,28 @@ +--- +- hosts: satellite6 + gather_facts: False + vars: + organization_id: "{{ org_id | default(1) }}" + search: "{{ search_query | default('container') }}" + + tasks: + - name: List all products in the organization + command: > + hammer --csv --no-headers product list --organization "{{ organization_name }}" --fields "id" + register: product_list + changed_when: false + + - name: Loop through each product and get repositories + command: hammer --csv --no-headers repository list --product-id "{{ item }}" --organization-id "{{ organization_id }}" + with_items: "{{ product_list.stdout_lines }}" + register: repositories_list + + - name: Debug the repositories list for each product (for inspection) + debug: + msg: "Repositories for {{ item }}: {{ repositories_list.stdout_lines }}" + loop: "{{ product_list.stdout_lines }}" + loop_control: + label: "{{ item }}" + +# task for activation key +# task for content view diff --git a/playbooks/tests/cleanup.yaml b/playbooks/tests/cleanup.yaml new file mode 100644 index 00000000..7dddc96e --- /dev/null +++ b/playbooks/tests/cleanup.yaml @@ -0,0 +1,29 @@ +--- +- hosts: satellite6 + gather_facts: False + vars: + organization_id: "{{ org_id | default(1) }}" + search: "{{ search_query | default('container') }}" + + tasks: + - name: List all products in the organization + command: > + hammer --csv --no-headers product list --organization "{{ organization_name }}" --fields "id" + register: product_list + changed_when: false + + - name: Loop through each product and get repositories + command: hammer --csv --no-headers repository list --product-id "{{ item }}" --organization-id "{{ organization_id }}" + with_items: "{{ product_list.stdout_lines }}" + register: repositories_list + + - name: Debug the repositories list for each product (for inspection) + debug: + msg: "Repositories for {{ item }}: {{ repositories_list.stdout_lines }}" + loop: "{{ product_list.stdout_lines }}" + loop_control: + label: "{{ item }}" + +# task for activation key +# task for content view +... diff --git a/playbooks/tests/prepare-env-for-host.yaml b/playbooks/tests/prepare-env-for-host.yaml new file mode 100644 index 00000000..6fdaf391 --- /dev/null +++ b/playbooks/tests/prepare-env-for-host.yaml @@ -0,0 +1,66 @@ +- hosts: satellite6 + remote_user: root + gather_facts: no + vars_files: + - ../../conf/satperf.yaml + - ../../conf/satperf.local.yaml + tasks: + - name: create org + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" organization create --name "MyOrg" + + - name: create loc + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" organization create --name "MyLoc" + + - name: add org + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" add-organization --name "MyLoc" --organization "MyOrg" + + - name: environment create + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" environment create --name "MyEnvironment" --organization "MyOrg" --locations "MyLoc" + + - name: add environment + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" add-environment --puppet-environment MyEnvironment --name "MyOrg" + + - name: medium create + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" medium create --os-family "Redhat" --name "RHEL mirror" --path "http://download.eng.brq.redhat.com/released/rhel-6-7-8/rhel-8/RHEL-8/8.4.0/BaseOS/x86_64/os/" --organization "MyOrg" --locations "MyLoc" + + - name: subnet create + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" subnet create --name "mysubnet" --network "192.168.111.0" --mask "255.255.255.0" --gateway "192.168.111.1" --dns-primary "192.168.111.10" --ipam "DHCP" --from "192.168.111.110" --to "192.168.111.240" --tftp-id "1" --dhcp-id "1" --dns-id "1" --organizations "MyOrg" --locations "MyLoc" + + - name: domain create + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" domain create --name "mydomain.lan" --dns-id "1" --organizations "MyOrg" --locations "MyLoc" DOMAIN_ID=$(hammer --csv domain list --per-page 9999 | grep mydomain.lan | tail -n1 | awk -F, '{print $1}') + + - name: compute-resource create + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" compute-resource create --provider "libvirt" --name "MyLibvirtComputeResource" --set-console-password "false" --url "qemu+ssh://root@192.168.111.1/system" --organizations "MyOrg" --locations "MyLoc" + + # For testing we don't need to have them locked + + - name: lock + command: "{{item}}" + with_items: + - echo "ProvisioningTemplate.update_all(locked: false)" | foreman-rake console + - hammer template build-pxe-default + - PROV_TEMPLATES="Kickstart default,Kickstart default finish,Kickstart default PXELinux,Kickstart default user data" + + - name: hammer architecture create + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" os create --name "RHEL" --major 8 --minor 4 --description="RHEL 8.4" --media "RHEL mirror" --provisioning-templates "$PROV_TEMPLATES" --architectures "x86_64" --family Redhat --partition-tables "Kickstart default" + + - name: hammer architecture create + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" hostgroup create --name "RHEL 8.4" --architecture x86_64 --pxe-loader "PXELinux BIOS" --domain mydomain.lan --subnet mysubnet --operatingsystem "RHEL 8.4" --medium "RHEL mirror" --partition-table "Kickstart default" --organizations "MyOrg" --locations "MyLoc" + + - name: hammer architecture create + command: + hammer -u "{{ sat_user}}" -p "{{ sat_pass }}" lifecycle-environment create --organization="MyOrg" --prior="Library" --name="MyLifecycleEnvironment" + +... +