Common deploy tasks for projects made at Le Phare.
- lephare/ansible:3.0.0 - Ansible 2.20+ - Python 3.9 - 3.14 (Target node)
- lephare/ansible:2.0.0 - Ansible 2.17 - Python 3.7 - 3.12 (Target node)
- lephare/ansible:1.12.3 - Ansible 2.15.4 - Python 2.7 or Python 3.5 - 3.11 (Target node)
See Ansible core support matrix
- Workflow overview
- Cachetool
- Composer:
- Symfony:
- Permissions
- Remove files
defaults vars declared in this module can be found here: defaults/main.yml
This module overrides defaults vars from cbrunnkvist.ansistrano-symfony-deploy and ansistrano.deploy.
These overrides can be found here: vars/main.yml
---
- name: Deploy app
hosts: app
roles:
- lephare.ansible-deploy
vars:
lephare_rollbar_token: <token>
ansistrano_git_repo: git@gitlab.com:foo/bar.git
ansistrano_shared_paths:
- var/logs
- var/sessions
- var/http_cache
ansistrano_shared_files:
- app/config/parameters.ymlNB: Only works with postgres installed on the app node
Backup la base de données de la version courante lors du déploiement. Un fichier portant le nom de la base de données est placer dans la release courante.
Enable task:
lephare_dump_database: trueSet vars:
app_database_name: "{{ db_pull_remote_database_name }}" # required
app_database_login_host: "locahost" # optional
app_database_user: "{{ db_pull_remote_database_user }}" # required
app_database_password: "{{ db_pull_remote_database_password }}" # required
app_database_login_port: 5432 # optional, default 5432We use a docker image lephare/ansible to deploy our projects.
docker run -it --rm \
-v $(shell pwd):/app
-v $(SSH_AUTH_SOCK):/ssh-agent \
-v $(HOME)/.ssh:/home/ansible/.ssh:ro \
-e SSH_AUTH_SOCK=/ssh-agent \
lephare/ansible \
ansible-playbook \
-i ansible/production/hosts \
ansible/deploy.ymlSupported PostgreSQL versions: 9 - 18.
Set this Ansible variable to the version used in your project:
lephare_postgresql_version: 18or alternatively:
db_pull_postgresql_createdb_binary_path: "/usr/lib/postgresql/15/bin/createdb"
db_pull_postgresql_dropdb_binary_path: "/usr/lib/postgresql/15/bin/dropdb"
db_pull_postgresql_pg_restore_binary_path: "/usr/lib/postgresql/15/bin/pg_restore"
db_pull_postgresql_pg_dump_binary_path: "/usr/lib/postgresql/15/bin/pg_dump" # Path on the remote machine (Debian in this example). Only needed if the default remote `pg_dump` binary isn't the one you want.Clone or fork the repository and make your change in a branch (below is an example for a "fastcgi" branch).
You can test your modification by building your own docker image:
cd docker
docker build -f Dockerfile.dev .. -t lephare/ansible:fastcgi --no-cacheMIT