#cloud-config
repo_update: true
repo_upgrade: all
package_upgrade: true
packages:
- httpd24
- php56
- mysql55-server
- php56-mysqlnd
runcmd:
- service httpd start
- chkconfig httpd on
- groupadd www - [ sh, -c, "usermod -a -G www ec2-user" ]
- [ sh, -c, "chown -R root:www /var/www" ]
- chmod 2775 /var/www
- [ find, /var/www, -type, d, -exec, chmod, 2775, {}, + ]
- [ find, /var/www, -type, f, -exec, chmod, 0664, {}, + ]
- [ sh, -c, 'echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php' ]
AWS : https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/user-data.html
OpenStack : https://docs.openstack.org/nova/queens/user/user-data.html
$ openstack server create --image ubuntu-cloudimage --flavor 1 \
--user-data mydata.file VM_INSTANCE
Obs: É possivel executar diretamente um bash no cloud-init
#!/bin/bash
echo “Sua execução”
Oficial : http://cloud-init.org/
Documentos:
http://cloudinit.readthedocs.io/en/latest/
http://cloudinit.readthedocs.io/en/latest/topics/hacking.html
http://cloudinit.readthedocs.io/en/latest/topics/examples.html
https://help.ubuntu.com/community/CloudInit
Ubuntu Cloud-Init : https://www.youtube.com/watch?v=-zL3BdbKyGY