Skip to content

Commit

Permalink
Fix Vagrant setup (#690)
Browse files Browse the repository at this point in the history
This mostly changes the Ansible configuration to be compatible with Vagrant:

 - Use Debian Buster
 - Enable pipelining in ansible.cfg
   (see https://docs.ansible.com/ansible/latest/user_guide/become.html#risks-of-becoming-an-unprivileged-user )
 - Use python3 for starting ansible on the host (default interpreter_python
   in ansible.cfg)
 - Some cleanup based on Ansible warnings (mostly stop using loops
   for `apt`)
  • Loading branch information
Elarnon committed Jun 27, 2020
1 parent 1799598 commit aa504da
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure(2) do |config|
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
#
config.vm.box = "debian/contrib-jessie64"
config.vm.box = "debian/contrib-buster64"

config.vm.synced_folder ".", "/vagrant"

Expand Down
5 changes: 5 additions & 0 deletions ansible.cfg
@@ -0,0 +1,5 @@
[defaults]
interpreter_python = python3

[ssh_connection]
pipelining = True
28 changes: 14 additions & 14 deletions provisioning/roles/mangaki_source/tasks/main.yml
Expand Up @@ -14,28 +14,29 @@

- name: Ensure python and virtualenv are installed and up-to-date.
apt:
name: '{{ item }}'
name:
- 'build-essential'
- 'python3'
- 'python3-dev'
- 'python3-virtualenv'
- 'python3-pip'
- 'python3-setuptools'
- 'virtualenv'
- 'git'
state: 'latest'
with_items:
- 'build-essential'
- 'python3'
- 'python3-dev'
- 'python3-virtualenv'
- 'virtualenv'
become: true

- name: Ensure virtualenv packages are up-to-date.
pip:
name: '{{ item }}'
name:
- 'pip'
- 'setuptools'
- 'git+https://github.com/mangaki/zero'
state: 'latest'
virtualenv: '{{ mangaki_source_venv_path }}'
virtualenv_python: 'python3'
become: true
become_user: '{{ mangaki_source_user }}'
with_items:
- 'pip'
- 'setuptools'
- 'git+https://github.com/mangaki/zero'

- name: Ensure packaged project is present.
copy:
Expand All @@ -55,11 +56,10 @@

- name: Ensure system-wide development dependencies are installed.
apt:
name: '{{ item }}'
name: ['git', 'tmux']
state: 'latest'
become: true
when: 'mangaki_source_install_type == "develop"'
with_items: ['git', 'tmux']

- name: Ensure debug-mode dependencies are installed.
pip:
Expand Down
4 changes: 2 additions & 2 deletions provisioning/roles/utils/celery/tasks/main.yml
Expand Up @@ -18,12 +18,12 @@
supervisorctl:
name: '{{ celery_name }}'
state: present
become: true
become: true|bool
when: start

- name: Run Celery beat.
supervisorctl:
name: '{{ celery_beat_name }}'
state: present
become: true
become: true|bool
when: celery_beat
9 changes: 4 additions & 5 deletions provisioning/roles/utils/postgresql/tasks/main.yml
@@ -1,12 +1,11 @@
---
- name: Ensure PostgreSQL is installed and up-to-date.
apt:
name: '{{ item }}'
name:
- 'postgresql'
- 'postgresql-contrib' # For extensions, e.g. unaccent and pg_trgm
- 'python3-psycopg2' # For management by ansible
state: 'latest'
with_items:
- 'postgresql'
- 'postgresql-contrib' # For extensions, e.g. unaccent and pg_trgm
- 'python3-psycopg2' # For management by ansible
become: true

- name: Ensure PostgreSQL is running.
Expand Down

0 comments on commit aa504da

Please sign in to comment.