ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    cloud-init verification or logs?

    IT Discussion
    cloud-init
    2
    5
    334
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • IRJI
      IRJ
      last edited by

      I am using cloud-init to run some startup scripts for my instances in terraform. What is really annoying is that if one line on your cloud-init script is incorrect, the script doesn't run at all. I had to manually remove lines one by one to find suspect lines. As I create more cloud-init scripts, I run into more issues.

      An alternative would be calling cloud-init to run a bash script, but I have had issues getting this to work in v12. It works fine in v11. Cloud-init is generally cross platform which is an advantage. You can essentially use the same script with any flavor of linux including Ubuntu, CentOS and Amazon. So I would like to figure out how to better troubleshoot and write cloud-init scripts.

      Although getting bash scripts working properly in v12 would be nice. All the examples I am seeing are in v11 and they dont seem to work in v12.

      1 Reply Last reply Reply Quote 1
      • stacksofplatesS
        stacksofplates
        last edited by

        They should be in journalctl right?

        So I don't have a ton of experience with the AWS side, but with GCP you define your startup scripts like this:

        terraform.png

        Here's what's in my script:

        #!/bin/bash
        
        sudo touch /etc/the_file
        
        sudo echo "is this working?" >> /etc/the_file
        
        cat /etc/this-file-doesnt-exist
        

        Then after boot, you can run jouranlctl --boot and it gives you logs since last boot.

        doesnt-exist.png

        1 Reply Last reply Reply Quote 1
        • IRJI
          IRJ
          last edited by

          Hoping to do some more testing this week and updated you @stacksofplates

          1 Reply Last reply Reply Quote 1
          • IRJI
            IRJ
            last edited by

            So I checked journalctl --boot which has a very large output. However I did find some helpful information about cloud-init. I got to see what Amazon does in their portion of the script, and I got to see when packages were installed from my cloud-init. However other commands such as sed or echo did not show up anywhere. Although I can confirm them being run.

            This kind of helps, but it isn't 100% what I want.

            stacksofplatesS 1 Reply Last reply Reply Quote 0
            • stacksofplatesS
              stacksofplates @IRJ
              last edited by

              @IRJ said in cloud-init verification or logs?:

              So I checked journalctl --boot which has a very large output. However I did find some helpful information about cloud-init. I got to see what Amazon does in their portion of the script, and I got to see when packages were installed from my cloud-init. However other commands such as sed or echo did not show up anywhere. Although I can confirm them being run.

              This kind of helps, but it isn't 100% what I want.

              Ah ok. That's interesting that they don't show up. It might just be stderr for the script portion then? Idk.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post