diff --git a/exercises/ansible_config_as_code/1-ee/README.md b/exercises/ansible_config_as_code/1-ee/README.md index 9c1ec0d36..57fcddb0f 100644 --- a/exercises/ansible_config_as_code/1-ee/README.md +++ b/exercises/ansible_config_as_code/1-ee/README.md @@ -215,6 +215,8 @@ ee_pull_collections_from_hub: false {% endraw %} +======= + Further documentation for those who are interested to learn more see: - [YAML lists and more](https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html) diff --git a/exercises/ansible_config_as_code/2-pah/README.md b/exercises/ansible_config_as_code/2-pah/README.md index 92f0558d5..20c54c66b 100644 --- a/exercises/ansible_config_as_code/2-pah/README.md +++ b/exercises/ansible_config_as_code/2-pah/README.md @@ -4,11 +4,7 @@ In this section you will configure your private automation hub using the code pr ## Step 1 -Ensure that you have `ansible-navigator` installed on your machine. - -```console -sudo dnf install ansible-navigator -``` +This lab uses `ansible-navigator` and has been tested against v3.4.1. It should be pre-installed on your machine. Further documentation for those who are interested to learn more see: @@ -22,12 +18,13 @@ Create a file `group_vars/all/ah_repositories.yml` you will need to add `infra.a --- ah_collection_remotes: - name: community-infra - url: https://beta-galaxy.ansible.com/ + url: https://galaxy.ansible.com/ requirements: - name: infra.ee_utilities - name: infra.aap_utilities - name: containers.podman - name: awx.awx + - name: community.general ah_collection_repositories: - name: community-infra-repo @@ -51,7 +48,7 @@ Further documentation for those who are interested to learn more see: {% raw %} -Create a file `group_vars/all/ah_users.yml` make sure this user has `is_superuser` set to `true` and their `password` is set to `"{{ ah_token_password }}"`. +Create a file `group_vars/all/ah_users.yml` make sure this user has their `password` set to `"{{ ah_token_password }}"`. ```yaml --- @@ -62,6 +59,7 @@ ah_users: - "admin" append: true state: "present" + is_superuser: true ... ``` @@ -83,7 +81,7 @@ Further documentation for those who are interested to learn more see: ## Step 5 -Create a playbook `playbooks/hub_config.yml` add in the `repository` role name in the first task and the `user` role name in the last task. +Create a playbook `playbooks/hub_config.yml` add in the `collection_remote` role name in the first task and the `user` role name in the last task. ```yaml --- @@ -96,7 +94,7 @@ Create a playbook `playbooks/hub_config.yml` add in the `repository` role name i tasks: - name: Include collection remote role ansible.builtin.include_role: - name: infra.ah_configuration. # Insert Collection Name here + name: infra.ah_configuration. # Insert Role Name here - name: Include collection repository role ansible.builtin.include_role: @@ -112,7 +110,7 @@ Create a playbook `playbooks/hub_config.yml` add in the `repository` role name i - name: Include user role ansible.builtin.include_role: - name: infra.ah_configuration. # Insert Collection Name here + name: infra.ah_configuration. # Insert Role Name here ... ``` @@ -120,9 +118,7 @@ Create a playbook `playbooks/hub_config.yml` add in the `repository` role name i The next step is to run the playbook, for demonstration purposes we are going to show how to get the Execution Environment(EE) that was built in the previous step and run the playbook. -If you wish to skip this step run the playbook this way[^1]. - -[^1]: `ansible-galaxy collection install infra.ah_configuration` then `ansible-playbook -i inventory.yml -l automationhub playbooks/hub_config.yml` +If you wish to skip this step and use the CLI instead of navigator, see the alternate instructions in the next section. Login to the automation hub using the podman login command. This will ask for a user:pass. After authenticating pull the config_as_code image. @@ -151,4 +147,13 @@ Use these options to run the playbook in the execution environment. ansible-navigator run playbooks/hub_config.yml --eei hub-student#.rh####.example.opentlc.com/config_as_code -i inventory.yml -l automationhub --pa='--tls-verify=false' -m stdout ``` +## Step 6 (Alternate) +If someone was wrong with your execution environment, or want to run this in the CLI instead of Navigator, use the following commands. + +```console +ansible-galaxy collection install infra.ah_configuration:2.0.3 +ansible-playbook -i inventory.yml -l automationhub playbooks/hub_config.yml +``` + + [previous task](../1-ee/README.md) [next task](../3-controller/README.md) diff --git a/exercises/ansible_config_as_code/3-controller/README.md b/exercises/ansible_config_as_code/3-controller/README.md index bd858e560..871164c2a 100644 --- a/exercises/ansible_config_as_code/3-controller/README.md +++ b/exercises/ansible_config_as_code/3-controller/README.md @@ -33,6 +33,7 @@ controller_execution_environments: ![execution_environments supported](images/ee_supportedv3.png) ![execution_environments minimal](images/ee_minimalv2.png) ![execution_environments 2.9](images/ee_29v2.png) +![execution_environments 2.9](images/ee_config_as_code.png) Further documentation for those who are interested to learn more see: @@ -83,15 +84,15 @@ controller_credential_types: env: AH_PASSWORD: !unsafe "{{ password }}" AH_USERNAME: !unsafe "{{ username }}" - AH_HOST: # Insert appropriate variable from above here + AH_HOST: !unsafe # Insert appropriate variable from above here AH_API_TOKEN: !unsafe # Insert appropriate variable from above here AH_VERIFY_SSL: !unsafe # Insert appropriate variable from above here extra_vars: ah_password: !unsafe "{{ password }}" ah_username: !unsafe "{{ username }}" - ah_host: # Insert appropriate variable from above here - ah_token: # Insert appropriate variable from above here - ah_validate_certs: # Insert appropriate variable from above here + ah_host: !unsafe # Insert appropriate variable from above here + ah_token: !unsafe # Insert appropriate variable from above here + ah_validate_certs: !unsafe # Insert appropriate variable from above here - name: ssh_priv_file kind: cloud @@ -138,7 +139,7 @@ Further documentation for those who are interested to learn more see: ## Step 5 -Create a file `group_vars/all/credentials.yml` and add the required information to the list `controller_credentials` to configure the UI to look like the screenshot +Create a file `group_vars/all/credentials.yml` and add the required information to the list `controller_credentials` to configure the UI to look like the screenshot. Make it to look like the screenshot, but make sure to use parameters for the values. DO NOT PASTE YOUR CLEARTEST CREDENTIALS! {% raw %} @@ -203,7 +204,7 @@ controller_credentials: username: student password: "{{ machine_pass }}" - - name: git + - name: github credential_type: Source Control organization: config_as_code description: git @@ -276,7 +277,7 @@ controller_inventory_sources: ... ``` -![inventory_source](images/inventory_source.png) +![inventory_source](images/inventory_source_v2.png) Further documentation for those who are interested to learn more see: @@ -454,10 +455,11 @@ Create a `collections/requirements.yml` file and add these collections to pull a --- collections: - name: infra.controller_configuration + version: 2.5.1 - name: infra.ah_configuration - - name: infra.ee_utilities - - name: infra.aap_utilities + version: 2.0.3 - name: awx.awx + version: 22.4.0 ... ``` diff --git a/exercises/ansible_config_as_code/3-controller/images/ee_config_as_code.png b/exercises/ansible_config_as_code/3-controller/images/ee_config_as_code.png new file mode 100644 index 000000000..85e845999 Binary files /dev/null and b/exercises/ansible_config_as_code/3-controller/images/ee_config_as_code.png differ diff --git a/exercises/ansible_config_as_code/3-controller/images/inventory_source_v2.png b/exercises/ansible_config_as_code/3-controller/images/inventory_source_v2.png new file mode 100644 index 000000000..6b7e11108 Binary files /dev/null and b/exercises/ansible_config_as_code/3-controller/images/inventory_source_v2.png differ diff --git a/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/ah_repositories.yml b/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/ah_repositories.yml index 3363f56f4..da4cf2221 100644 --- a/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/ah_repositories.yml +++ b/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/ah_repositories.yml @@ -1,7 +1,7 @@ --- ah_collection_remotes: - name: community-infra - url: https://beta-galaxy.ansible.com/ + url: https://galaxy.ansible.com/ requirements: - name: infra.ee_utilities - name: infra.controller_configuration diff --git a/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/credentials.yml b/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/credentials.yml index 03da13dee..e496e9a14 100644 --- a/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/credentials.yml +++ b/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/credentials.yml @@ -68,7 +68,7 @@ controller_credentials: username: student password: "{{ machine_pass }}" - - name: git + - name: github credential_type: Source Control organization: config_as_code description: git diff --git a/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/execution_environments.yml b/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/execution_environments.yml index 1dc196afc..4328d28af 100644 --- a/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/execution_environments.yml +++ b/exercises/ansible_config_as_code/answer_files/workshop_project/group_vars/all/execution_environments.yml @@ -14,4 +14,9 @@ controller_execution_environments: image: "{{ ah_host }}/ee-29-rhel8" pull: always credential: cr_ah + + - name: "config_as_code" + image: "{{ ah_host }}/config_as_code" + pull: always + credential: cr_ah ... diff --git a/exercises/ansible_config_as_code/answer_files/workshop_project/playbooks/hub_config.yml b/exercises/ansible_config_as_code/answer_files/workshop_project/playbooks/hub_config.yml index 0347fdf76..a6f186e9d 100644 --- a/exercises/ansible_config_as_code/answer_files/workshop_project/playbooks/hub_config.yml +++ b/exercises/ansible_config_as_code/answer_files/workshop_project/playbooks/hub_config.yml @@ -8,7 +8,7 @@ tasks: - name: Include collection remote role ansible.builtin.include_role: - name: infra.ah_configuration. # Insert Collection Name here + name: infra.ah_configuration.collection_remote - name: Include collection repository role ansible.builtin.include_role: @@ -24,5 +24,5 @@ - name: Include user role ansible.builtin.include_role: - name: infra.ah_configuration. # Insert Collection Name here + name: infra.ah_configuration.user ... diff --git a/roles/aws_dns/tasks/teardown.yml b/roles/aws_dns/tasks/teardown.yml index bc9e7a620..653788a9a 100644 --- a/roles/aws_dns/tasks/teardown.yml +++ b/roles/aws_dns/tasks/teardown.yml @@ -20,7 +20,7 @@ record: "student{{item}}.{{ec2_name_prefix|lower}}.{{workshop_dns_zone}}" type: A value: "{{ (records | first | first)['Value'] }}" - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" vars: records: '{{ record_sets.ResourceRecordSets | selectattr("Name", "match", "student" + item|string + "." + ec2_name_prefix|lower + "." + workshop_dns_zone) | map(attribute="ResourceRecords") | list }}' when: records | length > 0 @@ -41,7 +41,7 @@ record: "student{{item}}-sat.{{ec2_name_prefix|lower}}.{{workshop_dns_zone}}" type: A value: "{{ (records | first | first)['Value'] }}" - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" vars: records: '{{record_sets_sat.ResourceRecordSets | selectattr("Name", "match", "student" + item|string + "-sat." + ec2_name_prefix|lower + "." + workshop_dns_zone) | map(attribute="ResourceRecords") | list }}' when: records | length > 0 diff --git a/roles/control_node/templates/controller_eda_install.j2 b/roles/control_node/templates/controller_eda_install.j2 new file mode 100644 index 000000000..a688edd07 --- /dev/null +++ b/roles/control_node/templates/controller_eda_install.j2 @@ -0,0 +1,39 @@ +[automationcontroller] +{{ ansible_default_ipv4.address }} ansible_connection=local + +[automationedacontroller] +{{ ansible_default_ipv4.address }} ansible_connection=local + +[database] +{{ ansible_default_ipv4.address }} ansible_connection=local + + +[all:vars] +admin_password='{{ admin_password }}' +automationcontroller_client_max_body_size='20M' + +pg_host='{{ ansible_default_ipv4.address }}' +pg_port='5432' + +pg_database='awx' +pg_username='awx' +pg_password='{{ admin_password }}' +pg_sslmode='prefer' + +gpgcheck='{{ gpgcheck | default(1) }}' +aw_repo_url='{{ aw_repo_url | default("https://releases.ansible.com/ansible-tower/") }}' +ignore_preflight_errors = True + +registry_url='{{ ee_registry_name }}' +registry_username='{{ redhat_username }}' +registry_password='{{ redhat_password }}' + +controller_hostname='controller.replaceme.example.com' +automationedacontroller_hostname='eda.replaceme.example.com' + +automationedacontroller_admin_password='{{ admin_password }}' +automationedacontroller_pg_host='{{ ansible_default_ipv4.address }}' +automationedacontroller_pg_port=5432 +automationedacontroller_pg_database='automationedacontroller' +automationedacontroller_pg_username='automationedacontroller' +automationedacontroller_pg_password='{{ admin_password }}' \ No newline at end of file diff --git a/roles/gitlab_server/tasks/add-users.yml b/roles/gitlab_server/tasks/add-users.yml index 47ed6a18d..827da8386 100644 --- a/roles/gitlab_server/tasks/add-users.yml +++ b/roles/gitlab_server/tasks/add-users.yml @@ -125,7 +125,7 @@ "skip_confirmation": true } register: create_user - with_sequence: count="{{ student_total }}" + with_sequence: count="{{ student_total|int }}" - name: GitLab Post | Get local user information via API uri: @@ -138,5 +138,5 @@ headers: Content-Type: application/json Authorization: Bearer {{ gitlab_access_token.json.access_token }} - with_sequence: count="{{ student_total }}" + with_sequence: count="{{ student_total|int }}" register: gitlab_local_users diff --git a/roles/gitlab_server/tasks/gitea-add-users.yml b/roles/gitlab_server/tasks/gitea-add-users.yml index 47ed997eb..980531e22 100644 --- a/roles/gitlab_server/tasks/gitea-add-users.yml +++ b/roles/gitlab_server/tasks/gitea-add-users.yml @@ -36,7 +36,7 @@ --password """{{ admin_password }}""" --email student{{ item }}@example.com --must-change-password=false - with_sequence: count="{{ student_total }}" + with_sequence: count="{{ student_total|int }}" become_user: gitea register: gitearesult failed_when: diff --git a/roles/manage_ec2_instances/tasks/cockpit_machines.yml b/roles/manage_ec2_instances/tasks/cockpit_machines.yml index a1ad439af..03287fd33 100644 --- a/roles/manage_ec2_instances/tasks/cockpit_machines.yml +++ b/roles/manage_ec2_instances/tasks/cockpit_machines.yml @@ -7,4 +7,4 @@ template: src: "cockpit_machines/cockpit_machines_{{workshop_type}}.j2" dest: "{{ playbook_dir }}/{{ec2_name_prefix}}/student{{item}}-99-webui.json" - with_sequence: count="{{ student_total }}" + with_sequence: count="{{ student_total|int }}" diff --git a/roles/manage_ec2_instances/tasks/create_inventory.yml b/roles/manage_ec2_instances/tasks/create_inventory.yml index 9fb0a5bc6..227a3da75 100644 --- a/roles/manage_ec2_instances/tasks/create_inventory.yml +++ b/roles/manage_ec2_instances/tasks/create_inventory.yml @@ -32,13 +32,13 @@ template: src: "student_inventory/instances_{{workshop_type}}.j2" dest: "{{ playbook_dir }}/{{ec2_name_prefix}}/student{{item}}-instances.txt" - with_sequence: count="{{ student_total }}" + with_sequence: count="{{ student_total|int }}" - name: Generate student etchosts template: src: "etchosts/etchosts_{{workshop_type}}.j2" dest: "{{ playbook_dir }}/{{ec2_name_prefix}}/student{{item}}-etchosts.txt" - with_sequence: count="{{ student_total }}" + with_sequence: count="{{ student_total|int }}" - name: Generate instructor inventory template: diff --git a/roles/manage_ec2_instances/tasks/instances/attendance/attendance_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/attendance/attendance_instance_provision.yml index 85df2b66e..c99846e02 100644 --- a/roles/manage_ec2_instances/tasks/instances/attendance/attendance_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/attendance/attendance_instance_provision.yml @@ -25,7 +25,7 @@ owner: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: 'attendance-host' long_name: "attendance-host.{{ ec2_name_prefix }}.{{ workshop_dns_zone | default('') }}" username: "{{ ec2_info['attendance_host']['username'] }}" diff --git a/roles/manage_ec2_instances/tasks/instances/auto_satellite/auto_satellite_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/auto_satellite/auto_satellite_instance_provision.yml index e10b91809..6abcf85a5 100644 --- a/roles/manage_ec2_instances/tasks/instances/auto_satellite/auto_satellite_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/auto_satellite/auto_satellite_instance_provision.yml @@ -8,7 +8,7 @@ instance_type: "{{ ec2_info['satellite'].size[list_count|int] }}" image_id: "{{ sat_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: instance-state-name: running @@ -23,7 +23,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "satellite" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/centos_6/centos_6_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/centos_6/centos_6_instance_provision.yml index 4f49bd687..7f8d9d2f2 100644 --- a/roles/manage_ec2_instances/tasks/instances/centos_6/centos_6_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/centos_6/centos_6_instance_provision.yml @@ -8,7 +8,7 @@ instance_type: "{{ ec2_info[centos6].size[list_count|int] }}" image_id: "{{ node_ami_centos6.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: instance-state-name: running @@ -23,7 +23,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node7" username: "{{ ec2_info[centos6].username }}" ansible-workshops: "true" @@ -86,7 +86,7 @@ instance_type: "{{ ec2_info[centos6].size[list_count|int] }}" image_id: "{{ node_ami_centos6.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: instance-state-name: running @@ -101,7 +101,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node8" username: "{{ ec2_info[centos6].username }}" ansible-workshops: "true" @@ -163,7 +163,7 @@ instance_type: "{{ ec2_info[centos6].size[list_count|int] }}" image_id: "{{ node_ami_centos6.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: instance-state-name: running @@ -178,7 +178,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node9" username: "{{ ec2_info[centos6].username }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/centos_7/centos_7_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/centos_7/centos_7_instance_provision.yml index 9835bcb9c..92dcff6a8 100644 --- a/roles/manage_ec2_instances/tasks/instances/centos_7/centos_7_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/centos_7/centos_7_instance_provision.yml @@ -8,7 +8,7 @@ instance_type: "{{ ec2_info[centos7].size[list_count|int] }}" image_id: "{{ node_ami_centos7.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: instance-state-name: running @@ -23,7 +23,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node4" username: "{{ ec2_info[centos7].username }}" ansible-workshops: "true" @@ -86,7 +86,7 @@ instance_type: "{{ ec2_info[centos7].size[list_count|int] }}" image_id: "{{ node_ami_centos7.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: instance-state-name: running @@ -101,7 +101,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node5" username: "{{ ec2_info[centos7].username }}" ansible-workshops: "true" @@ -164,7 +164,7 @@ instance_type: "{{ ec2_info[centos7].size[list_count|int] }}" image_id: "{{ node_ami_centos7.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: instance-state-name: running @@ -179,7 +179,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node6" username: "{{ ec2_info[centos7].username }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/control_cluster/cluster_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/control_cluster/cluster_instance_provision.yml index 061c7ae60..1508e1578 100644 --- a/roles/manage_ec2_instances/tasks/instances/control_cluster/cluster_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/control_cluster/cluster_instance_provision.yml @@ -6,7 +6,7 @@ instance_type: "{{ ec2_info[control_type].size[list_count|int] }}" image_id: "{{ ansible_control_node_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: "tag:Workshop_ansible": "{{ ec2_name_prefix }}-ansible-{{ sequence }}" @@ -19,7 +19,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: "{{ ec2_info[control_type].username }}" short_name: "ansible-{{ sequence }}" ansible-workshops: "true" @@ -73,7 +73,7 @@ assume_role_policy_document: "{{ lookup('file','AssumeRole_policy.json') }}" create_instance_profile: true description: VPC Lockdown role for "{{ ec2_name_prefix }}" workshop - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" - name: Create control node instance role community.aws.iam_role: @@ -81,7 +81,7 @@ assume_role_policy_document: "{{ lookup('file','AssumeRole_policy.json') }}" create_instance_profile: true description: Control node instance role for "{{ ec2_name_prefix }}" workshop - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" - name: Generate IAM policy for control node IAM instance role community.aws.iam_policy: @@ -90,7 +90,7 @@ policy_name: "IAMPolicy_{{ ec2_name_prefix }}_student{{ item }}" state: present policy_json: "{{ lookup( 'template', 'iam_vpc_lockdown_policy.json.j2') }}" - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" loop_control: index_var: loop_idx diff --git a/roles/manage_ec2_instances/tasks/instances/devops/devops_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/devops/devops_instance_provision.yml index 6d3d44439..159ee80e4 100644 --- a/roles/manage_ec2_instances/tasks/instances/devops/devops_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/devops/devops_instance_provision.yml @@ -7,7 +7,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image: "{{ node1_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_node1: "{{ ec2_name_prefix }}-node1" tags: @@ -20,7 +20,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "dev_web1" username: "{{ ec2_info[rhel].username }}" Devops_tag: dev_web1 @@ -56,7 +56,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image: "{{ node2_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_node2: "{{ ec2_name_prefix }}-node2" tags: @@ -69,7 +69,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "dev_web2" username: "{{ ec2_info[rhel].username }}" Devops_tag: dev_web2 @@ -105,7 +105,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image: "{{ node3_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_node3: "{{ ec2_name_prefix }}-node3" tags: @@ -118,7 +118,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "prod_web1" username: "{{ ec2_info[rhel].username }}" Devops_tag: prod_web1 @@ -154,7 +154,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image: "{{ node4_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_node4: "{{ ec2_name_prefix }}-node4" tags: @@ -167,7 +167,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "prod_web2" username: "{{ ec2_info[rhel].username }}" Devops_tag: prod_web2 diff --git a/roles/manage_ec2_instances/tasks/instances/f5/f5_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/f5/f5_instance_provision.yml index 766c8d9ff..14f0122b2 100644 --- a/roles/manage_ec2_instances/tasks/instances/f5/f5_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/f5/f5_instance_provision.yml @@ -7,7 +7,7 @@ instance_type: "{{ ec2_info.f5node.size[list_count|int] }}" image_id: "{{ f5_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running network: assign_public_ip: true @@ -24,7 +24,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: "{{ ec2_info.f5node.username }}" short_name: "f5" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/f5/rhel_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/f5/rhel_instance_provision.yml index a27198164..facbbd523 100644 --- a/roles/manage_ec2_instances/tasks/instances/f5/rhel_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/f5/rhel_instance_provision.yml @@ -6,7 +6,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ f5_rhel_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running network: assign_public_ip: true @@ -23,7 +23,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner for F5 workshop" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: node1 username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -67,7 +67,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ f5_rhel_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running network: assign_public_ip: true @@ -84,7 +84,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner for F5 workshop" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: node2 username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/instances_automation_hub.yml b/roles/manage_ec2_instances/tasks/instances/instances_automation_hub.yml index 5b9eaf59b..332847bf6 100644 --- a/roles/manage_ec2_instances/tasks/instances/instances_automation_hub.yml +++ b/roles/manage_ec2_instances/tasks/instances/instances_automation_hub.yml @@ -22,7 +22,7 @@ AWS_USERNAME: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: "{{ ec2_info[hub_type].username }}" short_name: "automation-hub" long_name: "automation-hub.{{ ec2_name_prefix }}.{{ workshop_dns_zone | default ('') }}" diff --git a/roles/manage_ec2_instances/tasks/instances/instances_configascode.yml b/roles/manage_ec2_instances/tasks/instances/instances_configascode.yml index 1aa7c2588..1faf850a2 100644 --- a/roles/manage_ec2_instances/tasks/instances/instances_configascode.yml +++ b/roles/manage_ec2_instances/tasks/instances/instances_configascode.yml @@ -25,7 +25,7 @@ owner: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: 'gitlab' long_name: "gitlab.{{ ec2_name_prefix }}.{{ workshop_dns_zone | default('') }}" username: "{{ ec2_info['skylight_rhel8_gitlab']['username'] }}" @@ -53,7 +53,7 @@ instance_type: "{{ ec2_info[hub_type].size }}" image_id: "{{ ansible_hub_node_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running network: assign_public_ip: true @@ -69,7 +69,7 @@ AWS_USERNAME: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: "{{ ec2_info[hub_type].username }}" short_name: "automation-hub" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/instances_middleware.yml b/roles/manage_ec2_instances/tasks/instances/instances_middleware.yml index f359dcfb7..d4ff135b8 100644 --- a/roles/manage_ec2_instances/tasks/instances/instances_middleware.yml +++ b/roles/manage_ec2_instances/tasks/instances/instances_middleware.yml @@ -7,7 +7,7 @@ instance_type: "{{ ec2_info.middleware.size }}" image: "{{ node_ami_middleware.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_node1: "{{ ec2_name_prefix }}-node1" tags: @@ -20,7 +20,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node1" username: "{{ ec2_info.middleware.username }}" ansible-workshops: "true" @@ -55,7 +55,7 @@ instance_type: "{{ ec2_info.middleware.size }}" image: "{{ node_ami_middleware.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_node2: "{{ ec2_name_prefix }}-node2" tags: @@ -68,7 +68,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node2" username: "{{ ec2_info.middleware.username }}" ansible-workshops: "true" @@ -103,7 +103,7 @@ instance_type: "{{ ec2_info.middleware.size }}" image: "{{ node_ami_middleware.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_node3: "{{ ec2_name_prefix }}-node3" tags: @@ -116,7 +116,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node3" username: "{{ ec2_info.middleware.username }}" ansible-workshops: "true" @@ -153,7 +153,7 @@ instance_type: "{{ ec2_info.middleware.size }}" image: "{{ node_ami_middleware.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_isonode: "{{ ec2_name_prefix }}-isonode" tags: @@ -164,7 +164,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "isonode" username: "{{ ec2_info.middleware.username }}" ansible-workshops: "true" @@ -200,7 +200,7 @@ instance_type: "{{ ec2_info.middleware.size }}" image: "{{ node_ami_middleware.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_remotenode: "{{ ec2_name_prefix }}-remotenode" tags: @@ -211,7 +211,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "remotenode" username: "{{ ec2_info.middleware.username }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/instances_network.yml b/roles/manage_ec2_instances/tasks/instances/instances_network.yml index 080bb09a4..66224bce3 100644 --- a/roles/manage_ec2_instances/tasks/instances/instances_network.yml +++ b/roles/manage_ec2_instances/tasks/instances/instances_network.yml @@ -15,7 +15,7 @@ instance_type: "{{ ec2_info[rtr1_type].size }}" image_id: "{{ lookup('vars', rtr1_type ~ '_ami')['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" user_data: '' state: running network: @@ -33,7 +33,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "rtr1" ansible_network_os: "{{ ec2_info[rtr1_type].os }}" username: "{{ ec2_info[rtr1_type].username }}" @@ -73,7 +73,7 @@ instance_type: "{{ ec2_info[rtr2_type].size }}" image_id: "{{ lookup('vars', rtr2_type ~ '_ami')['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running user_data: '' network: @@ -91,7 +91,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "rtr2" ansible_network_os: "{{ ec2_info[rtr2_type].os }}" username: "{{ ec2_info[rtr1_type].username }}" @@ -131,7 +131,7 @@ instance_type: "{{ec2_info[rtr3_type].size }}" image_id: "{{ lookup('vars', rtr3_type ~ '_ami')['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" user_data: '' state: running network: @@ -149,7 +149,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "rtr3" ansible_network_os: "{{ ec2_info[rtr3_type].os }}" username: "{{ ec2_info[rtr3_type].username }}" @@ -189,7 +189,7 @@ instance_type: "{{ ec2_info[rtr4_type].size }}" image_id: "{{ lookup('vars', rtr4_type ~ '_ami')['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" user_data: '' state: running network: @@ -207,7 +207,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "rtr4" ansible_network_os: "{{ ec2_info[rtr4_type].os }}" username: "{{ ec2_info[rtr1_type].username }}" diff --git a/roles/manage_ec2_instances/tasks/instances/instances_security.yml b/roles/manage_ec2_instances/tasks/instances/instances_security.yml index d824b0154..f47bbb8b1 100644 --- a/roles/manage_ec2_instances/tasks/instances/instances_security.yml +++ b/roles/manage_ec2_instances/tasks/instances/instances_security.yml @@ -1,7 +1,7 @@ --- - set_fact: - async_timeout_seconds: "{{ student_total * 60 }}" - async_wait_for_retries: "{{ student_total * 10 }}" + async_timeout_seconds: "{{ student_total|int * 60 }}" + async_wait_for_retries: "{{ student_total|int * 10 }}" - name: Create EC2 Block - SECURITY MODE block: diff --git a/roles/manage_ec2_instances/tasks/instances/instances_windows.yml b/roles/manage_ec2_instances/tasks/instances/instances_windows.yml index 6cec6fe10..072a67a78 100644 --- a/roles/manage_ec2_instances/tasks/instances/instances_windows.yml +++ b/roles/manage_ec2_instances/tasks/instances/instances_windows.yml @@ -25,7 +25,7 @@ owner: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: 'gitlab' long_name: "gitlab.{{ ec2_name_prefix }}.{{ workshop_dns_zone | default('') }}" username: "{{ ec2_info['skylight_rhel8_gitlab']['username'] }}" @@ -53,7 +53,7 @@ instance_type: "{{ ec2_info['skylight_windows_instance']['size'] }}" image_id: "{{ win_instance_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running network: assign_public_ip: true @@ -71,7 +71,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "instance1" ansible-workshops: "true" wait: "{{ ec2_wait }}" @@ -94,7 +94,7 @@ instance_type: "{{ ec2_info['skylight_windows_instance']['size'] }}" image_id: "{{ win_instance_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running network: assign_public_ip: true @@ -112,7 +112,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "instance2" ansible-workshops: "true" wait: "{{ ec2_wait }}" diff --git a/roles/manage_ec2_instances/tasks/instances/rhel/rhel_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/rhel/rhel_instance_provision.yml index 46a302910..c1cdd4e76 100644 --- a/roles/manage_ec2_instances/tasks/instances/rhel/rhel_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/rhel/rhel_instance_provision.yml @@ -9,7 +9,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_node1": "{{ ec2_name_prefix }}-node1" @@ -23,7 +23,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node1" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -91,7 +91,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_node2": "{{ ec2_name_prefix }}-node2" @@ -105,7 +105,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node2" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -169,7 +169,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_node3": "{{ ec2_name_prefix }}-node3" @@ -183,7 +183,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "node3" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -249,7 +249,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_isonode": "{{ ec2_name_prefix }}-isonode" @@ -261,7 +261,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "isonode" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -310,7 +310,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_remotenode": "{{ ec2_name_prefix }}-remotenode" @@ -322,7 +322,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "remotenode" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/ripu/ripu_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/ripu/ripu_instance_provision.yml index 3f4c30137..4d6f9cabd 100644 --- a/roles/manage_ec2_instances/tasks/instances/ripu/ripu_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/ripu/ripu_instance_provision.yml @@ -9,7 +9,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel7.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_node1": "{{ ec2_name_prefix }}-node1" @@ -23,7 +23,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "{{ lookup('community.general.random_pet') }}" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -107,7 +107,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel7.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_node2": "{{ ec2_name_prefix }}-node2" @@ -121,7 +121,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "{{ lookup('community.general.random_pet') }}" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -201,7 +201,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel8.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_node3": "{{ ec2_name_prefix }}-node3" @@ -215,7 +215,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "{{ lookup('community.general.random_pet') }}" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -295,7 +295,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel8.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_node4": "{{ ec2_name_prefix }}-node4" @@ -309,7 +309,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "{{ lookup('community.general.random_pet') }}" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -391,7 +391,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_isonode": "{{ ec2_name_prefix }}-isonode" @@ -403,7 +403,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "isonode" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" @@ -452,7 +452,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image_id: "{{ node_ami_rhel.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" filters: instance-state-name: running "tag:Workshop_remotenode": "{{ ec2_name_prefix }}-remotenode" @@ -464,7 +464,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "remotenode" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/instances/storage/storage_instance_provision.yml b/roles/manage_ec2_instances/tasks/instances/storage/storage_instance_provision.yml index a261aa72e..78b01608e 100644 --- a/roles/manage_ec2_instances/tasks/instances/storage/storage_instance_provision.yml +++ b/roles/manage_ec2_instances/tasks/instances/storage/storage_instance_provision.yml @@ -7,7 +7,7 @@ instance_type: "{{ ec2_info[rhel].size[list_count|int] }}" image: "{{ netapp_ami.image_id }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" count_tag: Workshop_netapp: "{{ ec2_name_prefix }}-netapp" tags: @@ -19,7 +19,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" short_name: "netapp" username: "{{ ec2_info[rhel].username }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/inventory/addhost_configascode.yml b/roles/manage_ec2_instances/tasks/inventory/addhost_configascode.yml index 4c6ee183d..02de9cb1a 100644 --- a/roles/manage_ec2_instances/tasks/inventory/addhost_configascode.yml +++ b/roles/manage_ec2_instances/tasks/inventory/addhost_configascode.yml @@ -52,7 +52,7 @@ state: absent instance_ids: "{{ generic_hub_host_facts.instances | map(attribute='instance_id') | list }}" wait: true - wait_timeout: "{{ student_total * 300 | int}}" + wait_timeout: "{{ student_total|int * 300 | int}}" register: result_ec2_destroy - name: Add automation hub instance to host group diff --git a/roles/manage_ec2_instances/tasks/resources/resources.yml b/roles/manage_ec2_instances/tasks/resources/resources.yml index 8b6ab5e2a..0a7e7169b 100644 --- a/roles/manage_ec2_instances/tasks/resources/resources.yml +++ b/roles/manage_ec2_instances/tasks/resources/resources.yml @@ -11,7 +11,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" Workshop_type: "{{ workshop_type }}" Workshop: "{{ ec2_name_prefix }}" ansible-workshops: "true" @@ -39,7 +39,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" Workshop_type: "{{ workshop_type }}" Workshop: "{{ ec2_name_prefix }}" ansible-workshops: "true" @@ -63,7 +63,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" Workshop_type: "{{ workshop_type }}" Workshop: "{{ ec2_name_prefix }}" ansible-workshops: "true" @@ -83,7 +83,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" Workshop_type: "{{ workshop_type }}" Workshop: "{{ ec2_name_prefix }}" ansible-workshops: "true" @@ -99,7 +99,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "Total {{ student_total }}" + Students: "Total {{ student_total|int }}" Workshop_type: "{{ workshop_type }}" Workshop: "{{ ec2_name_prefix }}" ansible-workshops: "true" @@ -120,7 +120,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" Workshop_type: "{{ workshop_type }}" Workshop: "{{ ec2_name_prefix }}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/resources/resources_network.yml b/roles/manage_ec2_instances/tasks/resources/resources_network.yml index a88ef9503..39ef3d8c2 100644 --- a/roles/manage_ec2_instances/tasks/resources/resources_network.yml +++ b/roles/manage_ec2_instances/tasks/resources/resources_network.yml @@ -8,7 +8,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" ansible-workshops: "true" register: create_vpc2 when: ec2_vpc_id2 is undefined @@ -25,7 +25,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" ansible-workshops: "true" rules: - proto: 47 @@ -79,7 +79,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" ansible-workshops: "true" register: create_subnet2 until: create_subnet2 is not failed @@ -94,7 +94,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "Total {{student_total}}" + Students: "Total {{ student_total|int }}" ansible-workshops: "true" register: igw2 until: igw2 is not failed @@ -114,7 +114,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" ansible-workshops: "true" register: routetablenetworking until: routetablenetworking is not failed diff --git a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_checkpoint_gw_eni_bookkeeping.yml b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_checkpoint_gw_eni_bookkeeping.yml index 7144b0ee9..1c5e602a8 100644 --- a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_checkpoint_gw_eni_bookkeeping.yml +++ b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_checkpoint_gw_eni_bookkeeping.yml @@ -14,7 +14,7 @@ state: present region: '{{ ec2_region }}' delete_on_termination: true - loop: '{{ range(0, student_total) | list }}' + loop: '{{ range(0, student_total|int) | list }}' async: "{{ async_timeout_seconds }}" poll: 0 register: ec2_subnet1_eni_checkpoint_gw_async @@ -25,7 +25,7 @@ state: present region: '{{ ec2_region }}' delete_on_termination: true - loop: '{{ range(0, student_total) | list }}' + loop: '{{ range(0, student_total|int) | list }}' async: "{{ async_timeout_seconds }}" poll: 0 register: ec2_subnet2_eni_checkpoint_gw_async @@ -78,7 +78,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" Subnet: '{{ ec2_name_prefix }}-subnet1' Workshop: "{{ ec2_name_prefix }}" uuid: "{{ ec2_name_prefix }}" @@ -102,7 +102,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" Subnet: '{{ ec2_name_prefix }}-subnet1' Workshop: "{{ ec2_name_prefix }}" uuid: "{{ ec2_name_prefix }}" @@ -125,7 +125,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" Subnet: '{{ ec2_name_prefix }}-subnet2' Workshop: "{{ ec2_name_prefix }}" uuid: "{{ ec2_name_prefix }}" @@ -210,7 +210,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" short_name: "checkpoint_gw" username: "{{ec2_info.checkpoint_gw.username}}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_attacksim.yml b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_attacksim.yml index 9aa975c34..2ffbf4b6a 100644 --- a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_attacksim.yml +++ b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_attacksim.yml @@ -6,7 +6,7 @@ instance_type: "{{ ec2_info['rhel8']['size'][list_count|int] }}" image_id: "{{ attacker_ami['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: "tag:Workshop_attacker": "{{ ec2_name_prefix }}-attacker" @@ -19,7 +19,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: '{{ ec2_info["rhel8"]["username"] }}' short_name: "attacker" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_checkpoint_mgmt.yml b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_checkpoint_mgmt.yml index 131c020f6..0b54ad1bd 100644 --- a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_checkpoint_mgmt.yml +++ b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_checkpoint_mgmt.yml @@ -6,7 +6,7 @@ instance_type: "{{ ec2_info['checkpoint_mgmt']['size'][list_count|int] }}" image_id: "{{ checkpoint_mgmt_ami['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" user_data: "{{ lookup('template', 'gaia-mgmt-ftw-user-data.sh.j2') }}" state: running filters: @@ -20,7 +20,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: "{{ ec2_info['checkpoint_mgmt']['username'] }}" short_name: "checkpoint_mgmt" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_qradar.yml b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_qradar.yml index f006144e9..adf334fea 100644 --- a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_qradar.yml +++ b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_qradar.yml @@ -6,7 +6,7 @@ instance_type: "{{ ec2_info['qradar']['size'][list_count|int] }}" image_id: "{{ qradar_ami['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: "tag:Workshop_qradar": "{{ ec2_name_prefix }}-qradar" @@ -19,7 +19,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: '{{ ec2_info["qradar"]["username"] }}' short_name: "qradar" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_snort.yml b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_snort.yml index 5f97539a0..51f62be5d 100644 --- a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_snort.yml +++ b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_snort.yml @@ -6,7 +6,7 @@ instance_type: "{{ ec2_info['rhel8']['size'][list_count|int] }}" image_id: "{{ snort_ami['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: "tag:Workshop_snort": "{{ ec2_name_prefix }}-snort" @@ -19,7 +19,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: '{{ ec2_info["rhel8"]["username"] }}' short_name: "snort" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_splunk.yml b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_splunk.yml index 766002382..8fe5ae47f 100644 --- a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_splunk.yml +++ b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_splunk.yml @@ -6,7 +6,7 @@ instance_type: "{{ ec2_info['splunk_enterprise']['size'][list_count|int] }}" image_id: "{{ splunk_ami['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running filters: "tag:Workshop_splunk": "{{ ec2_name_prefix }}-splunk" @@ -19,7 +19,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: '{{ ec2_info["splunk_enterprise"]["username"] }}' short_name: "splunk" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_windows_ws.yml b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_windows_ws.yml index 740f98f53..996c66a2d 100644 --- a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_windows_ws.yml +++ b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_create_instances_windows_ws.yml @@ -6,7 +6,7 @@ instance_type: "{{ ec2_info['windows_ws']['size'][list_count|int] }}" image_id: "{{ windows_ws_ami['image_id'] }}" region: "{{ ec2_region }}" - exact_count: "{{ student_total }}" + exact_count: "{{ student_total|int }}" state: running user_data: "{{ lookup('template', 'windows_userdata.txt.j2') }}" filters: @@ -20,7 +20,7 @@ owner: "{{ aws_user }}" Info: "AWS_USERNAME that provisioned this-> {{ aws_user }}" Ansible_Workshops: "This was provisioned through the ansible workshops provisioner" - Students: "{{ student_total }}" + Students: "{{ student_total|int }}" username: "{{ ec2_info['windows_ws']['username'] }}" short_name: "windows_ws" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_subnet2_eni.yml b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_subnet2_eni.yml index cab228fe1..cc9b5f2ea 100644 --- a/roles/manage_ec2_instances/tasks/security_includes/security_ec2_subnet2_eni.yml +++ b/roles/manage_ec2_instances/tasks/security_includes/security_ec2_subnet2_eni.yml @@ -96,7 +96,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" Subnet: '{{ ec2_name_prefix }}-subnet2' Workshop: "{{ec2_name_prefix}}" ansible-workshops: "true" @@ -117,7 +117,7 @@ Username: "{{ aws_user }}" Info: "Username that provisioned this-> {{ aws_user }}" Linklight: "This was provisioned through the linklight provisioner" - Students: "{{student_total}}" + Students: "{{ student_total|int }}" Subnet: '{{ ec2_name_prefix }}-subnet2' Workshop: "{{ec2_name_prefix}}" ansible-workshops: "true" diff --git a/roles/manage_ec2_instances/tasks/teardown.yml b/roles/manage_ec2_instances/tasks/teardown.yml index 77ff42b6b..a78b372d1 100644 --- a/roles/manage_ec2_instances/tasks/teardown.yml +++ b/roles/manage_ec2_instances/tasks/teardown.yml @@ -114,7 +114,7 @@ state: absent instance_ids: "{{ all_workshop_vpc_nodes.instances | map(attribute='instance_id') | list }}" wait: true - wait_timeout: "{{ student_total * 300 | int}}" + wait_timeout: "{{ student_total|int * 300 | int}}" register: result_ec2_destroy when: - all_workshop_vpc_nodes.instances @@ -140,7 +140,7 @@ state: absent instance_ids: "{{ all_workshop_vpc2_nodes.instances | map(attribute='instance_id') | list }}" wait: true - wait_timeout: "{{ student_total * 300 | int}}" + wait_timeout: "{{ student_total|int * 300 | int}}" register: result_ec2_destroy2 when: - ec2_vpc_id2 is defined @@ -421,21 +421,21 @@ iam_name: "ControlNode_{{ ec2_name_prefix }}_student{{ item }}" policy_name: "IAMPolicy_{{ ec2_name_prefix }}_student{{ item }}" state: absent - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" - name: Remove VPC Lock Down role community.aws.iam_role: name: "VPCLockDown_{{ ec2_name_prefix }}_student{{ item }}" state: absent delete_instance_profile: true - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" - name: Remove control node instance role community.aws.iam_role: name: "ControlNode_{{ ec2_name_prefix }}_student{{ item }}" state: absent delete_instance_profile: true - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" when: tower_node_aws_api_access|default(false)|bool ignore_errors: true diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_configascode.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_configascode.j2 index 35931137f..d5d00847f 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_configascode.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_configascode.j2 @@ -46,7 +46,7 @@ ansible_ssh_private_key_file="{{ playbook_dir }}/{{ ec2_name_prefix }}/{{ ec2_na {% endfor %} {% endif %} -{% for user in range(1,student_total + 1) %} +{% for user in range(1,student_total|int + 1) %} [student{{ user }}] {% for host in hostvars %} {% if "student" + user|string + "-" in host -%} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_demo.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_demo.j2 index 45ebe143d..f1d05c500 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_demo.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_demo.j2 @@ -12,7 +12,7 @@ ansible_port={{ ssh_port }} {% endfor %} {% endif %} -{% for number in range(1,student_total + 1) %} +{% for number in range(1,student_total|int + 1) %} [student{{ number }}] {% for host in ansible_node_facts.instances %} {% if 'student' ~ number == host.tags.Student %} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_devops.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_devops.j2 index 7a5418dce..a97b4455f 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_devops.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_devops.j2 @@ -12,7 +12,7 @@ ansible_port={{ ssh_port }} {% endfor %} {% endif %} -{% for number in range(1,student_total + 1) %} +{% for number in range(1,student_total|int + 1) %} [student{{ number }}] {% for host in ansible_node_facts.instances %} {% if 'student' ~ number == host.tags.Student %} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_f5.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_f5.j2 index c0c4feae3..55dd9ff40 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_f5.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_f5.j2 @@ -12,7 +12,7 @@ ansible_port={{ ssh_port }} {% endfor %} {% endif %} -{% for number in range(1,student_total + 1) %} +{% for number in range(1,student_total|int + 1) %} [student{{ number }}] {% for host in ansible_node_facts.instances %} {% if 'student' ~ number == host.tags.Student %} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_middleware.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_middleware.j2 index 77f03123e..b31a420b8 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_middleware.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_middleware.j2 @@ -3,7 +3,7 @@ ansible_port={{ ssh_port }} {% endif %} -{% for number in range(1,student_total + 1) %} +{% for number in range(1,student_total|int + 1) %} [student{{ number }}] {% for host in ansible_node_facts.instances %} {% if 'student' ~ number == host.tags.Student %} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_network.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_network.j2 index 50df9cd5b..ffb2c99cd 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_network.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_network.j2 @@ -16,7 +16,7 @@ ansible_ssh_private_key_file="{{ playbook_dir }}/{{ ec2_name_prefix }}/{{ ec2_na {% endfor %} {% endif %} -{% for number in range(1,student_total + 1) %} +{% for number in range(1,student_total|int + 1) %} [student{{ number }}] {% for host in ansible_node_facts.instances %} {% if 'student' ~ number == host.tags.Student %} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_rhel.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_rhel.j2 index 378a1d10f..2ab40b400 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_rhel.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_rhel.j2 @@ -4,7 +4,7 @@ ansible_port={{ ssh_port }} ansible_ssh_private_key_file="{{ playbook_dir }}/{{ ec2_name_prefix }}/{{ ec2_name_prefix }}-private.pem" {% endif %} -{% for number in range(1,student_total + 1) %} +{% for number in range(1,student_total|int + 1) %} [student{{ number }}] {% for host in ansible_node_facts.instances %} {% if 'student' ~ number == host.tags.Student %} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_ripu.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_ripu.j2 index f6eb0027d..8bba9f5f8 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_ripu.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_ripu.j2 @@ -4,7 +4,7 @@ ansible_port={{ ssh_port }} ansible_ssh_private_key_file="{{ playbook_dir }}/{{ ec2_name_prefix }}/{{ ec2_name_prefix }}-private.pem" {% endif %} -{% for number in range(1,student_total + 1) %} +{% for number in range(1,student_total|int + 1) %} [student{{ number }}] {% for host in ansible_node_facts.instances %} {% if 'student' ~ number == host.tags.Student %} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_security.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_security.j2 index 2cc8a641f..e62044ec4 100644 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_security.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_security.j2 @@ -12,7 +12,7 @@ ansible_port={{ ssh_port }} {% endfor %} {% endif %} -{% for number in range(1,student_total + 1) %} +{% for number in range(1,student_total|int + 1) %} [student{{ number }}] {% for host in ansible_node_facts.instances %} {% if 'student' ~ number == host.tags.Student %} diff --git a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_windows.j2 b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_windows.j2 index 221b60f45..d2b2156a4 100755 --- a/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_windows.j2 +++ b/roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_windows.j2 @@ -60,7 +60,7 @@ ansible_ssh_private_key_file="{{ playbook_dir }}/{{ ec2_name_prefix }}/{{ ec2_na {% endfor %} {% endif %} -{% for user in range(1,student_total + 1) %} +{% for user in range(1,student_total|int + 1) %} [student{{ user }}] {% for host in hostvars %} {% if "student" + user|string + "-" in host -%} diff --git a/roles/splunk_enterprise/tasks/main.yml b/roles/splunk_enterprise/tasks/main.yml index b0ea48c7f..3080fc582 100644 --- a/roles/splunk_enterprise/tasks/main.yml +++ b/roles/splunk_enterprise/tasks/main.yml @@ -12,7 +12,7 @@ query: record_sets hosted_zone_id: "{{AWSINFO.zone_id}}" start_record_name: "student1.{{ec2_name_prefix|lower}}.{{workshop_dns_zone}}" - max_items: "{{student_total}}" + max_items: "{{ student_total|int }}" register: record_sets - name: DELETE DNS ENTRIES FOR EACH STUDENT @@ -23,7 +23,7 @@ record: "student{{item}}.{{ec2_name_prefix|lower}}.{{workshop_dns_zone}}" type: A value: "{{ (records | first | first)['Value'] }}" - loop: "{{ range(1, student_total + 1)|list }}" + loop: "{{ range(1, student_total|int + 1)|list }}" vars: records: '{{record_sets.ResourceRecordSets | selectattr("Name", "match", "student" + item|string + "." + ec2_name_prefix|lower + "." + workshop_dns_zone) | map(attribute="ResourceRecords") | list }}' when: records diff --git a/roles/tower_request/tasks/main.yml b/roles/tower_request/tasks/main.yml index db6a5d730..d2bd78e18 100644 --- a/roles/tower_request/tasks/main.yml +++ b/roles/tower_request/tasks/main.yml @@ -15,7 +15,7 @@ ec2_name_prefix: "{{ ec2_name_prefix }}" aws_user: "{{ aws_user }}" ec2_region: "{{ ec2_region }}" - student_total: "{{ student_total }}" + student_total: "{{ student_total|int }}" workshop_type: "{{ workshop_type }}" body_format: json rescue: diff --git a/roles/webservers/tasks/ripu.yml b/roles/webservers/tasks/ripu.yml index 33d6ccd4f..d57d65570 100644 --- a/roles/webservers/tasks/ripu.yml +++ b/roles/webservers/tasks/ripu.yml @@ -27,3 +27,35 @@ baseurl: https://people.redhat.com/bmader/leapp-supplements-demo/RHEL/$releasever/$basearch gpgcheck: false enabled: false + +- name: Gather distribution and distribution_major_version facts + ansible.builtin.setup: + gather_subset: + - '!all' + - distribution + - distribution_major_version + +- name: Code block for sshd_config modification on RHEL7 nodes + block: + - name: Set PasswordAuthentication no in sshd_config + ansible.builtin.lineinfile: + path: /etc/ssh/sshd_config + regexp: '^PasswordAuthentication' + line: "PasswordAuthentication no" + + - name: restart ssh + service: + name: sshd + state: restarted + + - name: Wait 400 seconds (using ansible.builtin.wait_for) + ansible.builtin.wait_for: + host: "{{ ansible_host }}" + timeout: 400 + port: 22 + vars: + ansible_connection: local + + when: + - ansible_distribution == 'RedHat' + - ansible_distribution_major_version|int == 7 diff --git a/roles/workshop_attendance/templates/workshop.sql.j2 b/roles/workshop_attendance/templates/workshop.sql.j2 index 19fc7600a..29bafa335 100644 --- a/roles/workshop_attendance/templates/workshop.sql.j2 +++ b/roles/workshop_attendance/templates/workshop.sql.j2 @@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS `users` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -{% for number in range(1, student_total + 1) %} +{% for number in range(1, student_total|int + 1) %} {% for host in groups['control_nodes'] %} {% if hostvars[host].student is defined and "student" + number | string == hostvars[host].student %} {% if hostvars[host].student is defined and "student" + number | string == hostvars[host].student %} diff --git a/roles/workshop_check_setup/files/security_requirements.yml b/roles/workshop_check_setup/files/security_requirements.yml new file mode 100644 index 000000000..0563f8434 --- /dev/null +++ b/roles/workshop_check_setup/files/security_requirements.yml @@ -0,0 +1,8 @@ +--- +roles: + - name: ansible_security.ids_config + src: https://github.com/ansible-security/ids_config + - name: ansible_security.ids_install + src: https://github.com/ansible-security/ids_install + - name: geerlingguy.repo-epel + src: https://github.com/geerlingguy/ansible-role-repo-epel \ No newline at end of file diff --git a/roles/workshop_check_setup/tasks/security.yml b/roles/workshop_check_setup/tasks/security.yml index a9ed7b92e..862a97ef0 100644 --- a/roles/workshop_check_setup/tasks/security.yml +++ b/roles/workshop_check_setup/tasks/security.yml @@ -8,20 +8,6 @@ - name: Install required roles community.general.ansible_galaxy_install: type: role - name: "{{ item }}" + requirements_file: "{{ role_path }}/files/security_requirements.yml" dest: ./workshop_specific/roles/ - async: 600 - poll: 0 - loop: - - 'geerlingguy.repo-epel' - - 'ansible_security.ids_config' - - 'ansible_security.ids_install' register: required_role_loop_out - -- name: Install required roles | Async - ansible.builtin.async_status: - jid: "{{ item['ansible_job_id'] }}" - loop: "{{ required_role_loop_out['results'] }}" - register: job_result - until: job_result.finished - retries: 30