Created
February 13, 2021 13:28
-
-
Save vitbyst/f3293131325dbcb81bb055dae8d0404d to your computer and use it in GitHub Desktop.
Cloud Init Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #cloud-config | |
| package_upgrade: true | |
| packages: | |
| - zsh | |
| - tmux | |
| - nmap | |
| - curl | |
| - wget | |
| - git | |
| - htop | |
| - iperf | |
| - fail2ban | |
| - vim | |
| hostname: web01 | |
| fqdn: web01.example.com | |
| users: | |
| - name: myuser | |
| groups: sudo | |
| shell: /bin/zsh | |
| sudo: ['ALL=(ALL) NOPASSWD:ALL'] | |
| ssh-authorized-keys: | |
| - ssh-rsa AAAAB3NzaC... | |
| runcmd: | |
| - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config | |
| - sed -i 's|[#]*PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config | |
| - sed -i 's|UsePAM yes|UsePAM no|g' /etc/ssh/sshd_config | |
| - restart ssh | |
| - curl -L https://omnitruck.chef.io/install.sh | bash | |
| final_message: "The system is finally up, after $UPTIME seconds" | |
| # CentOS on Digital Ocean not working for some reason but Ubuntu 14.04 does | |
| # cloud-init logs: /var/log/cloud-init.log and /var/log/cloud-init-output.log | |
| # References: | |
| # - https://cloudinit.readthedocs.io/en/latest/ | |
| # - https://help.ubuntu.com/community/CloudInit | |
| # - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/4/html/End_User_Guide/user-data.html | |
| # - https://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/files/head:/doc/examples/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment