move pre_tasks into dedicated prepare playbook, refactoring some conditions
This commit is contained in:
parent
81c912ce96
commit
0cc48533aa
|
@ -1,7 +1,13 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
hosts: instance
|
||||
become: yes
|
||||
|
||||
pre_tasks:
|
||||
- name: Debug vars
|
||||
debug:
|
||||
msg:
|
||||
"php_cassandra_php_driver_repo": "{{ php_cassandra_php_driver_repo }}"
|
||||
|
||||
vars:
|
||||
php_enable_webserver: false
|
||||
|
@ -15,54 +21,5 @@
|
|||
- apcu
|
||||
- redis
|
||||
|
||||
handlers:
|
||||
- name: update apt cache
|
||||
apt:
|
||||
update_cache: true
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=true cache_valid_time=600
|
||||
when: ansible_os_family == 'Debian'
|
||||
changed_when: false
|
||||
|
||||
# Ubuntu-specific tasks.
|
||||
- name: Ensure dirmngr is installed (gnupg dependency).
|
||||
apt:
|
||||
name: dirmngr
|
||||
state: present
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Add repository for PHP 7.
|
||||
apt_repository: repo='ppa:ondrej/php'
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
# Debian-specific tasks.
|
||||
- name: Add dependencies for PHP versions (Debian).
|
||||
apt:
|
||||
name:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- gnupg2
|
||||
state: present
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: Add Ondrej Sury's apt key (Debian).
|
||||
apt_key:
|
||||
url: https://packages.sury.org/php/apt.gpg
|
||||
state: present
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: Add Ondrej Sury's repo (Debian).
|
||||
apt_repository:
|
||||
repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
when: ansible_distribution == "Debian"
|
||||
notify: update apt cache
|
||||
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
||||
roles:
|
||||
- name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}"
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
- name: Prepare
|
||||
hosts: instance
|
||||
become: yes
|
||||
|
||||
handlers:
|
||||
- name: update apt cache
|
||||
apt:
|
||||
update_cache: true
|
||||
|
||||
tasks:
|
||||
- name: Update apt cache.
|
||||
apt:
|
||||
update_cache: true
|
||||
cache_valid_time: 600
|
||||
|
||||
- name: Ensure dirmngr is installed (gnupg dependency).
|
||||
apt:
|
||||
name: dirmngr
|
||||
state: present
|
||||
|
||||
# Ubuntu-specific tasks.
|
||||
- name: Add Ondrej Sury's repo (Ubuntu).
|
||||
apt_repository:
|
||||
repo: ppa:ondrej/php
|
||||
state: present
|
||||
notify: update apt cache
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
# Debian-specific tasks.
|
||||
- name: Add ondrej repository for Debian
|
||||
block:
|
||||
- name: Add dependencies for PHP versions (Debian).
|
||||
apt:
|
||||
name:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- gnupg2
|
||||
state: present
|
||||
|
||||
- name: Add Ondrej Sury's apt key (Debian).
|
||||
apt_key:
|
||||
url: https://packages.sury.org/php/apt.gpg
|
||||
state: present
|
||||
|
||||
- name: Add Ondrej Sury's repo (Debian).
|
||||
apt_repository:
|
||||
repo: deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main
|
||||
state: present
|
||||
notify: update apt cache
|
||||
when: ansible_distribution == 'Debian'
|
||||
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
Loading…
Reference in New Issue