Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion collections/requirements.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
collections:

- name: redhat.satellite

- name: redhat.rhv
Expand Down
5 changes: 3 additions & 2 deletions devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
schemaVersion: 2.2.0
metadata:
name: ansible-provision-development
components:
- container:
args: ['tail', '-f', '/dev/null']
image: 'towerpah.shadowman.dev/devee:latest'
args: [tail, -f, /dev/null]
image: towerpah.shadowman.dev/devee:latest
memoryRequest: 256M
memoryLimit: 6Gi
cpuRequest: 250m
Expand Down
2 changes: 1 addition & 1 deletion removefromAD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
community.windows.win_domain_computer:
name: "{{ fqdn.split('.')[0] }}"
state: absent
delegate_to: "dc01.ad.shadowman.dev"
delegate_to: dc01.ad.shadowman.dev
2 changes: 1 addition & 1 deletion rhv_snapshot_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gather_facts: false

vars:
shadowman_snapshot: "create"
shadowman_snapshot: create

roles:
- shadowman_snapshots
2 changes: 1 addition & 1 deletion rhv_snapshot_pull_collection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gather_facts: false

vars:
shadowman_snapshot: "pull_collection"
shadowman_snapshot: pull_collection

roles:
- shadowman_snapshots
2 changes: 1 addition & 1 deletion rhv_snapshot_restore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gather_facts: false

vars:
shadowman_snapshot: "restore"
shadowman_snapshot: restore

roles:
- shadowman_snapshots
2 changes: 1 addition & 1 deletion rhv_template_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gather_facts: false

vars:
shadowman_template: "createtemplate"
shadowman_template: createtemplate

roles:
- shadowman_template_create
4 changes: 2 additions & 2 deletions rhv_vm_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gather_facts: false

vars:
shadowman_provision_hypervisor: "RHV"
shadowman_provision_hypervisor: RHV

roles:
- shadowman_provision
Expand All @@ -15,7 +15,7 @@
gather_facts: false

vars:
shadowman_provision_hypervisor: "RHV"
shadowman_provision_hypervisor: RHV

roles:
- shadowman_hostnameset
2 changes: 1 addition & 1 deletion rhv_vm_remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
gather_facts: false

vars:
shadowman_provision_hypervisor: "RHV"
shadowman_provision_hypervisor: RHV

roles:
- shadowman_deprovision
2 changes: 1 addition & 1 deletion rhv_vmfortemplate_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gather_facts: false

vars:
shadowman_template: "createvm"
shadowman_template: createvm

roles:
- shadowman_template_create
2 changes: 1 addition & 1 deletion roles/shadowman_agentcert/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
dest: /etc/assisted-service/service-ca-cert.crt
owner: root
group: root
mode: '0644'
mode: "0644"

- name: Restart agent service
ansible.builtin.systemd:
Expand Down
12 changes: 6 additions & 6 deletions roles/shadowman_aws_account_clear/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
_region_: us-east-2
vpc_name: "Shadowman VPC"
igw_name: "Shadowman IGW"
subnet_name: "Shadowman Subnet"
_route_table_name_: "Shadowman Route Table"
_security_group_: "ShadowmanSG"
_key_name_: "Shadowmankey"
vpc_name: Shadowman VPC
igw_name: Shadowman IGW
subnet_name: Shadowman Subnet
_route_table_name_: Shadowman Route Table
_security_group_: ShadowmanSG
_key_name_: Shadowmankey
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Delete AWS Create EC2 Security Group for Windows
amazon.aws.ec2_security_group:
name: "{{ _security_group_ }}_Windows"
Expand All @@ -18,7 +19,7 @@
amazon.aws.ec2_vpc_route_table_info:
region: "{{ _region_ }}"
filters:
"tag:Name": "{{ _route_table_name_ }}"
tag:Name: "{{ _route_table_name_ }}"
register: routetableresult
tags:
- account
Expand All @@ -38,7 +39,7 @@
amazon.aws.ec2_vpc_subnet_info:
region: "{{ _region_ }}"
filters:
"tag:Name": "{{ subnet_name }}"
tag:Name: "{{ subnet_name }}"
register: subnetresult
tags:
- account
Expand All @@ -57,7 +58,7 @@
amazon.aws.ec2_vpc_igw_info:
region: "{{ _region_ }}"
filters:
"tag:Name": "{{ igw_name }}"
tag:Name: "{{ igw_name }}"
register: igwresult
tags:
- account
Expand All @@ -75,7 +76,7 @@
amazon.aws.ec2_vpc_net_info:
region: "{{ _region_ }}"
filters:
"tag:Name": "{{ vpc_name }}"
tag:Name: "{{ vpc_name }}"
register: vpcresult
tags:
- account
Expand Down
1 change: 1 addition & 0 deletions roles/shadowman_aws_account_clear/tasks/aws_key_remove.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Delete EC2 Key
amazon.aws.ec2_key:
name: "{{ _key_name_ }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/shadowman_aws_account_clear/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
- name: Remove Keys
ansible.builtin.include_tasks: aws_key_remove.yml
tags:
- key
- key

- name: Remove VPC
ansible.builtin.include_tasks: aws_account_remove.yml
tags:
- account
- account
12 changes: 6 additions & 6 deletions roles/shadowman_deprovision/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ vm_names: "{{ vm_name.split(',') }}"
datacenter: Default
resource_group: Demo
_region_: us-east-2
vpc_name: "Shadowman VPC"
igw_name: "Shadowman IGW"
subnet_name: "Shadowman Subnet"
_route_table_name_: "Shadowman Route Table"
_security_group_: "ShadowmanSG"
_key_name_: "Shadowmankey"
vpc_name: Shadowman VPC
igw_name: Shadowman IGW
subnet_name: Shadowman Subnet
_route_table_name_: Shadowman Route Table
_security_group_: ShadowmanSG
_key_name_: Shadowmankey
3 changes: 2 additions & 1 deletion roles/shadowman_deprovision/tasks/aws_vm_remove.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
- name: Delete EC2 Instance
amazon.aws.ec2_instance:
region: "{{ _region_ }}"
filters:
"tag:Name": "{{ item }}"
tag:Name: "{{ item }}"
state: absent
loop: "{{ vm_names }}"
delegate_to: localhost
1 change: 0 additions & 1 deletion roles/shadowman_deprovision/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Remove RHV VM
ansible.builtin.include_tasks: rhv_vm_remove.yml
when: shadowman_provision_hypervisor == "RHV"
Expand Down
4 changes: 2 additions & 2 deletions roles/shadowman_deprovision/tasks/vmware_vm_remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
- name: Turn off VM
vmware.vmware_rest.vcenter_vm_power:
state: stop
vm: '{{ search_result.value[0].vm }}'
vm: "{{ search_result.value[0].vm }}"
vcenter_validate_certs: false
delegate_to: localhost

- name: Delete some VM
vmware.vmware_rest.vcenter_vm:
state: absent
vm: '{{ search_result.value[0].vm }}'
vm: "{{ search_result.value[0].vm }}"
vcenter_validate_certs: false
delegate_to: localhost
2 changes: 1 addition & 1 deletion roles/shadowman_hosted_cluster/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
datacenter: Default
cluster: Default
template: "hypershift-hosted-worker"
template: hypershift-hosted-worker
vm_names: "{{ vm_name.split(',') }}"
vm_state: running
# shadowman_storage_domain: NFS_Cersei
Expand Down
131 changes: 65 additions & 66 deletions roles/shadowman_hosted_cluster/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,78 @@
---
- name: Block for RHV
block:
- name: Login to RHV
redhat.rhv.ovirt_auth:
hostname: "{{ rhvm_fqdn }}"
username: "{{ rhvm_user }}"
password: "{{ rhvm_password }}"
ca_file: "{{ rhvm_cafile | default(omit) }}"
insecure: "{{ rhvm_insecure | default(true) }}"

- name: Login to RHV
redhat.rhv.ovirt_auth:
hostname: "{{ rhvm_fqdn }}"
username: "{{ rhvm_user }}"
password: "{{ rhvm_password }}"
ca_file: "{{ rhvm_cafile | default(omit) }}"
insecure: "{{ rhvm_insecure | default(true) }}"

- name: Create and run VM from template
redhat.rhv.ovirt_vm:
auth: "{{ ovirt_auth }}"
name: "{{ item }}"
template: "{{ template }}"
cluster: "{{ cluster }}"
storage_domain: "{{ shadowman_storage_domain }}"
high_availability: true
state: "{{ vm_state }}"
wait: true
loop: "{{ vm_names }}"
- name: Create and run VM from template
redhat.rhv.ovirt_vm:
auth: "{{ ovirt_auth }}"
name: "{{ item }}"
template: "{{ template }}"
cluster: "{{ cluster }}"
storage_domain: "{{ shadowman_storage_domain }}"
high_availability: true
state: "{{ vm_state }}"
wait: true
loop: "{{ vm_names }}"

- name: Apply OCP tag
redhat.rhv.ovirt_tag:
auth: "{{ ovirt_auth }}"
name: "ocp_hosted"
state: attached
vms:
- "{{ item }}"
loop: "{{ vm_names }}"
- name: Apply OCP tag
redhat.rhv.ovirt_tag:
auth: "{{ ovirt_auth }}"
name: ocp_hosted
state: attached
vms:
- "{{ item }}"
loop: "{{ vm_names }}"

- name: Apply Owner tag
redhat.rhv.ovirt_tag:
auth: "{{ ovirt_auth }}"
name: "{{ owner.split('@')[0] }}"
state: attached
vms:
- "{{ item }}"
loop: "{{ vm_names }}"
when: owner is defined
- name: Apply Owner tag
redhat.rhv.ovirt_tag:
auth: "{{ ovirt_auth }}"
name: "{{ owner.split('@')[0] }}"
state: attached
vms:
- "{{ item }}"
loop: "{{ vm_names }}"
when: owner is defined

- name: Apply environment tag
redhat.rhv.ovirt_tag:
auth: "{{ ovirt_auth }}"
name: "test"
state: attached
vms:
- "{{ item }}"
loop: "{{ vm_names }}"
- name: Apply environment tag
redhat.rhv.ovirt_tag:
auth: "{{ ovirt_auth }}"
name: test
state: attached
vms:
- "{{ item }}"
loop: "{{ vm_names }}"

- name: Test for IP address
redhat.rhv.ovirt_nic_info:
vm: "{{ vm_name }}"
fetch_nested: true
nested_attributes:
- ips
name: nic1
auth: "{{ ovirt_auth }}"
register: results
until: results.ovirt_nics[0].reported_devices[0].ips[0].version | default("False") == "v4"
retries: 60
delay: 10
- name: Test for IP address
redhat.rhv.ovirt_nic_info:
vm: "{{ vm_name }}"
fetch_nested: true
nested_attributes:
- ips
name: nic1
auth: "{{ ovirt_auth }}"
register: results
until: results.ovirt_nics[0].reported_devices[0].ips[0].version | default("False") == "v4"
retries: 60
delay: 10

- name: Set stats for IP
ansible.builtin.set_stats:
data:
workerip: "{{ results.ovirt_nics[0].reported_devices[0].ips[0].address }}"
per_host: false
- name: Set stats for IP
ansible.builtin.set_stats:
data:
workerip: "{{ results.ovirt_nics[0].reported_devices[0].ips[0].address }}"
per_host: false

- name: Add Linux hosts to just_created group
ansible.builtin.add_host:
hostname: "{{ vm_name }}"
ansible_host: "{{ results.ovirt_nics[0].reported_devices[0].ips[0].address }}"
groups: just_created
- name: Add Linux hosts to just_created group
ansible.builtin.add_host:
hostname: "{{ vm_name }}"
ansible_host: "{{ results.ovirt_nics[0].reported_devices[0].ips[0].address }}"
groups: just_created

always:
- name: Logout from RHV
Expand Down
Loading