Code Monkey home page Code Monkey logo

Comments (5)

bryanl avatar bryanl commented on May 18, 2024 1

I ran a test of doctl compute droplet create with the --user-data-file with success. Curious if there is any clues in /var/log/cloud-init-output.log?

from doctl.

bryanl avatar bryanl commented on May 18, 2024

This is a feature I see used a bunch in doctl. Curious to what the first line of the file pointed to by --user-data-file looks like.

from doctl.

zubfatal avatar zubfatal commented on May 18, 2024

Sure thing, this is the entire script, except for the IP addresses :)

#!/bin/sh
for X in 1.2.3.4 2.3.4.5 do ; ufw allow from $X to any proto tcp port 22 ; done
sed -r -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashrc
echo '' >> /root/.bashrc
echo '# Force prompt in other colors for root' >> /root/.bashrc
echo "PS1='\${debian_chroot:+(\$debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '" >> /root/.bashrc

All it does is open SSH for a couple of IPs, enable color prompts for all users created later, and a specific colored prompt for root, not a big secret :)

from doctl.

zubfatal avatar zubfatal commented on May 18, 2024

@bryanl argh! sorry for the inconvenience man :( it seems there actually was an error in my stupid script

/var/log/cloud-init-output-log:

Cloud-init v. 0.7.5 running 'modules:final' at Tue, 19 Jul 2016 18:51:24 +0000. Up 21.83 seconds.
/var/lib/cloud/instance/scripts/part-001: 2: /var/lib/cloud/instance/scripts/part-001: Syntax error: word unexpected (expecting "do")
2016-07-19 14:51:24,487 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [2]
2016-07-19 14:51:24,490 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
2016-07-19 14:51:24,491 - util.py[WARNING]: Running scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/dist-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
Cloud-init v. 0.7.5 finished at Tue, 19 Jul 2016 18:51:24 +0000. Datasource DataSourceDigitalOcean.  Up 22.04 seconds

The line in my script should have been

for X in 1.2.3.4 2.3.4.5 ; do ufw allow from $X to any proto tcp port 22 ; done

the difference being placement of the semicolon and do
Hopefully i'll remember to check that log file :)

from doctl.

bryanl avatar bryanl commented on May 18, 2024

No problem. Sometimes the details are the killer!

from doctl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.