{"id":24849364,"url":"https://github.com/bugbiteme/demo-tform-basic-ec2-with-ansible","last_synced_at":"2025-09-03T05:40:19.815Z","repository":{"id":71384448,"uuid":"301533687","full_name":"bugbiteme/demo-tform-basic-ec2-with-ansible","owner":"bugbiteme","description":"Spin up and connect to an EC2 instance","archived":false,"fork":false,"pushed_at":"2023-03-24T18:24:19.000Z","size":22,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-02T09:12:21.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugbiteme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-05T20:37:56.000Z","updated_at":"2023-02-28T20:55:08.000Z","dependencies_parsed_at":"2023-04-11T17:17:15.581Z","dependency_job_id":null,"html_url":"https://github.com/bugbiteme/demo-tform-basic-ec2-with-ansible","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bugbiteme/demo-tform-basic-ec2-with-ansible","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-basic-ec2-with-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-basic-ec2-with-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-basic-ec2-with-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-basic-ec2-with-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugbiteme","download_url":"https://codeload.github.com/bugbiteme/demo-tform-basic-ec2-with-ansible/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-basic-ec2-with-ansible/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273397843,"owners_count":25098233,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-31T12:30:58.482Z","updated_at":"2025-09-03T05:40:19.756Z","avatar_url":"https://github.com/bugbiteme.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instructions\n\nYou can use terraform on its own to spin up a number of Red Hat Enterprise Linux \nEC2 instances in AWS (version 8.4)\n\nFeel free to set the variables how you see fit\n\nTerraform also produces a dynamic Ansible inventory file that can be used in\nplaybooks for configuring these sytems.\n\nAs an example, I have created a playbook that installs httpd on each new system, along\nwith a hello message in index.html, diplaying the OS version\n\n## Prerequisits\nInstall the following on your local system:\n - AWS cli\n - terraform\n - ansible (core)\n\n## To run the terraform script on its own  \n`terraform init`  \n`terraform apply` (type \"yes\" when prompted)  \n\noutput shows all the public IP addresses, as well as a cli string to ssh into one of \nthem.\n\ndelete everything by typing  \n`terraform destroy`\n\n## To run the ansible playbook\nOnce your ec2 instances have been provisioned, run the command  \n`ansible-playbook -i inventory playbook.yml`  \n\nThis will accomplish installing and testing httpd\n\n## To run them on one swoop\nI have created a helper sctipt called 'provision-and-config.sh' that does it all together  \n\n`sh ./provision-and-config.sh \u003coptional number of instances\u003e`   \nexamples:  \n  \nJust one ec2 instance (default)  \n`sh ./provision-and-config.sh`  \n  \nec2 instances  == 3  \n`sh ./provision-and-config.sh 3`\n\nrun `terraform destroy` afterwards when you are done  \n\n# For RHEL Insight Setup, run these scripts instead\n\nAdditional playbooks have been added to register your EC2 instances with a RHEL subscription\nand add them to Insights inventory:  \n- `rhel-reg-insights.yml`  \n\nUsage:  \n`ansible-playbook -i inventory rhel-reg-insights.yml --vault-id @prompt`  \n  \nNote:  \nvault data set in `vars/reg-data.yml` and must be encrypted with `ansible-vault`\n\n```\nansible-vault edit vars/reg-data.yml\n.\n.\nusername: \u003cRH Subscription Username\u003e\npassword: \u003cRH Subscription Password\u003e\n```\n  \nPlaybook to remove EC2 instances from the Insights inventory and unregister them:  \n- `rhel-unreg-insights.yml`\n\nScripts to provision/deprovision and register/unregister have been created as well:\n- `rhel-provision-and-register.sh`\n- `rhel-deprovision-and-unregister.sh`\n\n# Additional Notes\n\n## How to activate RHEL with your subscription via the command line\n\n### Prerequisites \n- Have a valid Red Hat Subscription\n\n### Steps\n- `sudo subscription-manager register --username \u003cusername\u003e --password \u003cpassword\u003e --auto-attach`\n\n\n## How to register your RHEL system with Red Hat Insights via the command line (RHEL 8.4)\n\n### Prerequisites  \n- Activate your RHEL (see above)\n- [Check Insights on how to add based on version of RHEL](https://console.redhat.com/insights/registration)\n\n### Steps\n- `sudo insights-client --register`\nor\n- `sudo rhc connect -u \u003cusername\u003e -p \u003cpassword\u003e`\n\n## To unregister RHEL system with Insights (decommisioning)\n- `sudo insights-client --unregister`\n\n## To ungregister RHEL system from subscription\n- `sudo subscription-manager unregister`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugbiteme%2Fdemo-tform-basic-ec2-with-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugbiteme%2Fdemo-tform-basic-ec2-with-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugbiteme%2Fdemo-tform-basic-ec2-with-ansible/lists"}