Skip to content

Commit

Permalink
PHRAS-1214 Allow debugger access to Vagrant host IP addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibaud Fabre committed Sep 27, 2016
1 parent 758938c commit b18fa2d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Vagrantfile
Expand Up @@ -26,12 +26,10 @@ def config_net(config)
"dev." + $hostname + ".vb"
]

#config.vm.network :public_network, type: "dhcp", bridge: "en0: Ethernet"

# Assign static IP if present in network config
if File.file?($root + "/.network.conf")
ipAddress = File.read($root + "/.network.conf")
config.vm.network :private_network, ip: ipAddress
#config.vm.network :private_network, ip: ipAddress
else
# vboxnet0 can be changed to use a specific private_network
config.vm.network :private_network, type: "dhcp"
Expand All @@ -48,6 +46,7 @@ end

# By default, the name of the VM is the project's directory name
$hostname = File.basename($root).downcase
$hostIps = `ip addr show | grep inet | grep -v inet6 | cut -d' ' -f6 | cut -d'/' -f1`.split("\n");

Vagrant.configure("2") do |config|

Expand Down Expand Up @@ -80,9 +79,10 @@ Vagrant.configure("2") do |config|
config.vm.provision "ansible" do |ansible|
ansible.playbook = "resources/ansible/playbook.yml"
ansible.limit = 'all'
ansible.verbose = 'v'
ansible.verbose = 'vvv'
ansible.extra_vars = {
hostname: $hostname,
host_addresses: $hostIps,
postfix: {
postfix_domain: $hostname + ".vb"
}
Expand All @@ -92,7 +92,9 @@ Vagrant.configure("2") do |config|
config.vm.provision "ansible", run: "always" do |ansible|
ansible.playbook = "resources/ansible/playbook-always.yml"
ansible.limit = 'all'
ansible.verbose = 'vvv'
ansible.extra_vars = {
host_addresses: $hostIps,
hostname: $hostname
}
end
Expand Down
6 changes: 6 additions & 0 deletions resources/ansible/roles/app/tasks/main.yml
Expand Up @@ -35,3 +35,9 @@
shell: 'bin/setup system:install --email=admin@{{ hostname }}.vb --password=admin --db-host=127.0.0.1 --db-port=3306 --db-user={{ mariadb.user }} --db-password={{ mariadb.password }} --db-template=fr --appbox={{ mariadb.database }} --databox={{ mariadb.databox_db }} --server-name=www.{{ hostname }}.vb --data-path=/vagrant/datas -y'
args:
chdir: /vagrant/

- name: Enable debugger for host IP addresses
shell: bin/setup system:config add debugger.allowed-ips "{{ item}}"
with_items: '{{ host_addresses }}'
args:
chdir: /vagrant/
8 changes: 6 additions & 2 deletions resources/ansible/roles/elasticsearch/tasks/main.yml
Expand Up @@ -17,13 +17,17 @@
- name: Install Dependencies
apt: pkg=oracle-java8-installer state=latest

- name: Download
- name: Remove temporary debian package
shell: rm -f /tmp/elasticsearch-{{ elasticsearch.version }}.deb
when: not is_installed

- name: Download debian package
get_url: >
url={{ elasticsearch_url }}
dest=/tmp/elasticsearch-{{ elasticsearch.version }}.deb
when: not is_installed

- name: Install
- name: Install debian package
apt: deb=/tmp/elasticsearch-{{ elasticsearch.version }}.deb
when: not is_installed

Expand Down

0 comments on commit b18fa2d

Please sign in to comment.