From 0a7f9d271efb4f97aaddcb39c173e986f5357d59 Mon Sep 17 00:00:00 2001 From: Sebastin Santy Date: Thu, 8 Jun 2017 23:07:52 +0530 Subject: Skipping some steps in ansible for rapid debugging (#92) * Adding --no-templates to checksetup * my proposed changes --- Vagrantfile | 8 +++++++- vagrant_support/apache.yml | 2 ++ vagrant_support/bmo-checksetup.j2 | 6 +++--- vagrant_support/checksetup.yml | 5 ++++- vagrant_support/playbook.yml | 4 ++++ vagrant_support/update.yml | 23 +++++++++++++++++++++++ 6 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 vagrant_support/update.yml diff --git a/Vagrantfile b/Vagrantfile index 96faf1392..2a1c4e9c4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -36,7 +36,7 @@ Vagrant.configure('2') do |config| # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. - config.vm.provision 'ansible_local', run: 'always' do |ansible| + config.vm.provision 'main', type: 'ansible_local', run: 'always' do |ansible| ansible.playbook = 'vagrant_support/playbook.yml' ansible.extra_vars = { WEB_IP: WEB_IP, @@ -47,6 +47,12 @@ Vagrant.configure('2') do |config| } end + if ARGV.include? '--provision-with' + config.vm.provision 'update', type: 'ansible_local', run: 'never' do |update| + update.playbook = 'vagrant_support/update.yml' + end + end + config.vm.define 'db' do |db| db.vm.box = 'centos/6' diff --git a/vagrant_support/apache.yml b/vagrant_support/apache.yml index e4399f612..c7159371c 100644 --- a/vagrant_support/apache.yml +++ b/vagrant_support/apache.yml @@ -4,9 +4,11 @@ src: apache.j2 dest: /etc/httpd/conf.d/bugzilla.conf mode: 0644 + when: LAZY == 0 - name: enable httpd service: name=httpd enabled=yes + when: LAZY == 0 - name: restart httpd service: name=httpd state=restarted diff --git a/vagrant_support/bmo-checksetup.j2 b/vagrant_support/bmo-checksetup.j2 index c35a323c3..a2695d0cf 100755 --- a/vagrant_support/bmo-checksetup.j2 +++ b/vagrant_support/bmo-checksetup.j2 @@ -3,10 +3,10 @@ cd /vagrant if [[ ! -f ~/localconfig || ! -f /data/params ]]; then - perl checksetup.pl /home/vagrant/checksetup_answers.txt - perl checksetup.pl /home/vagrant/checksetup_answers.txt + perl checksetup.pl "$@" /home/vagrant/checksetup_answers.txt + perl checksetup.pl "$@" /home/vagrant/checksetup_answers.txt else cp ~/localconfig /vagrant - perl checksetup.pl < /dev/null + perl checksetup.pl "$@" < /dev/null cp /vagrant/localconfig ~/ fi diff --git a/vagrant_support/checksetup.yml b/vagrant_support/checksetup.yml index 6b54ef18d..580cc9dd9 100644 --- a/vagrant_support/checksetup.yml +++ b/vagrant_support/checksetup.yml @@ -4,12 +4,14 @@ src: bmo-checksetup.j2 dest: /usr/local/bin/bmo-checksetup mode: 0755 + when: LAZY == 0 - name: bmo generate data script template: src: bmo-generate-data.j2 dest: /usr/local/bin/bmo-generate-data mode: 0755 + when: LAZY == 0 - name: bmo checksetup answers template: @@ -18,10 +20,11 @@ owner: vagrant group: vagrant mode: 0644 + when: LAZY == 0 - name: run checksetup become: false - shell: sg apache -c '/usr/local/bin/bmo-checksetup' + shell: sg apache -c '/usr/local/bin/bmo-checksetup --no-templates' - name: generate data become: false diff --git a/vagrant_support/playbook.yml b/vagrant_support/playbook.yml index f89d5295e..f5ff7335a 100644 --- a/vagrant_support/playbook.yml +++ b/vagrant_support/playbook.yml @@ -168,11 +168,15 @@ mode: 0755 - include: checksetup.yml + vars: + LAZY: 0 - include: cron.yml - include: jobqueue.yml - include: push.yml - include: email.yml - include: apache.yml + vars: + LAZY: 0 - include: devtools.yml - name: fix owner of /vagrant/template_cache diff --git a/vagrant_support/update.yml b/vagrant_support/update.yml new file mode 100644 index 000000000..879345c57 --- /dev/null +++ b/vagrant_support/update.yml @@ -0,0 +1,23 @@ +--- +- hosts: web + become: true + tasks: + + - name: add local symlink + file: path=/vagrant/local src=/opt/bmo/local state=link force=true + + - name: make bmo data dir + file: path=/data state=directory owner=vagrant group=apache mode=0775 + + - name: fix owner of /vagrant + file: path=/vagrant state=directory owner=vagrant group=apache recurse=yes + + - name: add data symlink + file: path=/vagrant/data src=/data state=link force=true + + - include: checksetup.yml + vars: + LAZY: 1 + - include: apache.yml + vars: + LAZY: 1 \ No newline at end of file -- cgit v1.2.3-24-g4f1b