Skip to main content

AWS Security Specialty Exam Practice Test

Installing Ansible with CloudFormation and Userdata

AWS game-changing feature of supporting YAML in Cloudformation is a blessing for people who would love to see things in a "proper" format with comments :). Also it reduces the number of lines when compared to JSON.

Thanks to Graham for his basic tutorial on YAML and CloudFormation, borrowed much of his code and added ansible install. I haven't used cfn-init in the below snippet. Will try to enhance the code in future and make it more sophisticated.

Please note: I have hard-coded values of my key-pair etc, feel free to remove them. Please do leave a comment if you are running into any issues. I have used RHEL image for this tutorial.


AWSTemplateFormatVersion: "2010-09-09"

Description: A sample template

Parameters:
  FilePath:
    Description: The path of the  file.
    Type: String
    Default: /home/ec2-user/userdata

Resources:
  MyEC2Instance:
    Type: "AWS::EC2::Instance" # 1 Quotes are unnecessary here - will they always be?
    Properties:
      ImageId: ami-26ebbc5c    # 2 Quotes removed from the example - still works
      InstanceType: t2.micro
      KeyName: gk-sairam
      Tags:                    # 3 Here I switch to using single spaces
       - Key: Role             # 4 Tag list item is inline
         Value: Test Instance
       -                       # 5 Next list item is block
         Key: Owner
         Value: GK
       -                       # 5 Next list item is block
         Key: name
         Value: gk-instance-1
      BlockDeviceMappings:     # 6 Switch back to double spaces
        -
          DeviceName: /dev/sdm
          Ebs:
            VolumeType: gp2
            VolumeSize: 10
      UserData:
        Fn::Base64: !Sub |     # No more Fn::Join needed
          #!/bin/bash
          echo "Testing Userdata" > ${FilePath}
          chown ec2-user.ec2-user ${FilePath}
          yum -y update
          yum -y install vim
          yum -y install net-tools
          yum -y install wget
          mkdir /tmp/ansible
          cd /tmp/ansible
          wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
          yum -y install epel-release-latest-7.noarch.rpm
          yum -y install ansible

Comments

  1. You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. CDN

    ReplyDelete
  2. This blog is really helpful to deliver updated affairs over internet which is really appraisable. link name

    ReplyDelete
  3. By default, files saved to the internal storage are private to your application and other applications cannot bomber women's black jacket access them (nor can the user). When the user uninstalls your application, these files are removed.

    ReplyDelete
  4. There are a few things to keep in mind when using a roaming SIM card. First, it is important to check with your home network provider to see if they offer roaming services and what the charges will be. Second, you will need to make sure that your device is compatible with the roaming network that you will be using. Finally, you should be aware of the potential for high charges when using data services while roaming. SimCard for travel

    ReplyDelete
  5. You have given essential data for us about Women's Black Amber Bracelet It is excellent and good for everyone. Keep posting. I am very thankful to you.

    ReplyDelete
  6. When utilizing a roaming SIM card, there are a few things to keep in mind. Audit Firms In Uae It is crucial to first confirm with your home network operator whether roaming services are available and what the costs will be. The compatibility of your smartphone with the roaming network you plan to use must be checked second.

    ReplyDelete
  7. In the excerpt that follows, I didn't use cfn-init. I'll try to improve the code and make it more complex in the future. Masters Green Jacket

    ReplyDelete
  8. It is imperative to first verify whether roaming services are offered and what the prices would be with your home network provider. You must confirm that Preparation of management accounts your device is functional with the roaming network you intend to use.

    ReplyDelete
  9. It is your responsibility to make sure your device is compatible with the roaming network you wish to use. It is imperative to first People Of Determination verify whether roaming services are offered and what the prices would be with your home network provider.

    ReplyDelete
  10. The second thing to check is whether your smartphone is compatible with the roaming network you intend to utilize. I appreciate you taking the time to publish this important information. The people always come because of the high-quality content. digimarketinginc.com

    ReplyDelete
  11. It is imperative to first verify whether roaming services are offered and what the prices would be with your home network provider. I didn't use cfn-init in the following excerpt. In the future, I'll work to enhance and complicate the code. Boston Celtics Finals Jacket

    ReplyDelete
  12. The second thing you must do is confirm that your smartphone is compatible with the roaming network you intend to use. Finally, you should be aware that Accounting Services For Small Business accessing data services while roaming may result in expensive fees.

    ReplyDelete
  13. If you're seeking CCNA Training in Noida, your search ends at APTRON NOIDA. With its extensive experience in providing high-quality IT training, APTRON NOIDA stands as a premier institute in the city. With a proven track record of transforming aspiring networking professionals into competent CCNA-certified experts, APTRON NOIDA offers a comprehensive training program that combines theoretical knowledge with practical hands-on experience.

    ReplyDelete
  14. A Data eSIM card, also known as an embedded SIM card or eUICC (embedded Universal Integrated Circuit Card), is a virtual SIM card that is built directly into a device and does not require a physical SIM card. It provides the same functionality as a traditional SIM card but is embedded within the device itself.

    ReplyDelete
  15. If you're aspiring to forge a successful career in networking, APTRON Solution Noida stands as your ideal partner. Our CCNA Training Institute in Noida offers an all-encompassing learning experience, blending theoretical knowledge with practical expertise. Join us to unlock the doors to a world of networking opportunities. Your journey towards becoming a proficient networking professional starts here.

    ReplyDelete

Post a Comment

Popular posts from this blog

AWS Security Specialty Exam Practice Test

Infrastructure as a Code and my two favorite tools!