Consigo subir a aplicação e entra via ssh
kalil@debian:~/Ansible/teste$ vagrant up
Bringing machine 'wordpress' up with 'virtualbox' provider...
==> wordpress: Importing base box 'ubuntu/trusty64'...
==> wordpress: Matching MAC address for NAT networking...
==> wordpress: Checking if box 'ubuntu/trusty64' is up to date...
==> wordpress: Setting the name of the VM: teste_wordpress_1546963372687_62796
==> wordpress: Clearing any previously set forwarded ports...
==> wordpress: Fixed port collision for 22 => 2222. Now on port 2200.
==> wordpress: Clearing any previously set network interfaces...
==> wordpress: Preparing network interfaces based on configuration...
wordpress: Adapter 1: nat
wordpress: Adapter 2: hostonly
==> wordpress: Forwarding ports...
wordpress: 22 (guest) => 2200 (host) (adapter 1)
==> wordpress: Running 'pre-boot' VM customizations...
==> wordpress: Booting VM...
==> wordpress: Waiting for machine to boot. This may take a few minutes...
wordpress: SSH address: 127.0.0.1:2200
wordpress: SSH username: vagrant
wordpress: SSH auth method: private key
wordpress:
wordpress: Vagrant insecure key detected. Vagrant will automatically replace
wordpress: this with a newly generated keypair for better security.
wordpress:
wordpress: Inserting generated public key within guest...
wordpress: Removing insecure key from the guest if it's present...
wordpress: Key inserted! Disconnecting and reconnecting using new SSH key...
==> wordpress: Machine booted and ready!
==> wordpress: Checking for guest additions in VM...
wordpress: The guest additions on this VM do not match the installed version of
wordpress: VirtualBox! In most cases this is fine, but in rare cases it can
kalil@debian:~/Ansible/teste$ vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-163-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Tue Jan 8 16:03:15 UTC 2019
System load: 0.42 Processes: 82
Usage of /: 3.6% of 39.34GB Users logged in: 0
Memory usage: 12% IP address for eth0: 10.0.2.15
Swap usage: 0%
Graph this data and manage this system at:
https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
New release '16.04.5 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
vagrant@vagrant-ubuntu-trusty-64:~$
`
/hosts/
[wordpress]
172.17.177.40 ansible_user=vagrant ansible_ssh_private_key_file="/home/kalil/Ansible/teste/.vagrant/machines/wordpress/virtualbox/private_key"
/provisioning/
---
- hosts: all
handlers:
- name: restart apache
service:
name: apache2
state: restarted
become: yes
tasks:
- name: 'Instala pacotes de dependencia do sistema operacional'
apt:
update_cache: yes
cache_valid_time: 3600 #1 hora
name: "{{ item }}"
state: latest
become: yes
with_items:
- php5
- apache2
- libapache2-mod-php5
- php5-gd
- libssh2-php
- php5-mcrypt
- mysql-server-5.6
- python-mysqldb
- php5-mysql
- name: 'Cria o banco no MySQL'
mysql_db:
name: wordpress
login_user: root
state: present
- name: 'Cria usuario no MySQL'
mysql_user:
login_user: root
name: wordpress_user
password: 12345
priv: 'wordpress.*:ALL'
state: present
- name: 'Baixa o arquivo de instalacao do Wordpress'
get_url:
url: https://wordpress.org/latest.tar.gz'
dest: '/tmp/wordpress.tar.gz'
mode: 0440
- name: 'Descompacta o wordpress'
unarchive:
src: '/tmp/wordpress.tar.gz'
dest: '/var/www/'
remote_src: yes
become: yes
- copy:
src: '/var/www/wordpress/wp-config-sample.php'
dest: '/var/www/wordpress/wp-config.php'
remote_src: yes
become: yes
- name: 'Configura o wp-config com as entradas do banco de dados'
replace:
path: '/var/www/wordpress/wp-config.php'
regexp: "{{ item.regex }}"
replace: "{{ item.value }}"
backup: yes
with_items:
- { regex: 'database_name_here', value: 'wordpress'}
- { regex: 'username_here', value: 'wordpress_user'}
- { regex: 'password_here', value: '12345'}
become: yes
- name: 'Configura Apache para servir o Wordpress'
copy:
src: 'files/000-default.conf'
dest: '/etc/apache2/sites-available/000-default.conf'
notify:
- restart apache
become: yes