Skip to content
Snippets Groups Projects
Commit 1aaaea11 authored by Chris Croome's avatar Chris Croome
Browse files

Use apt repo for ansible_local facts

parent 52d7be8f
No related branches found
No related tags found
1 merge request!1Merge Sury
Pipeline #25765 passed
#!/usr/bin/env bash
# Ansible managed
set -euo pipefail
DPKG="/usr/bin/dpkg"
if [[ -f "${DPKG}" ]]; then
ARCH=$("${DPKG}" --print-architecture)
jo state=present arch="${ARCH}"
else
jo state=absent
fi
---
- name: Ansible phpquery local facts
block:
- name: Required packages present
ansible.builtin.apt:
pkg:
- aptitude
- jo
state: present
- name: Ansible facts.d directory present
ansible.builtin.file:
path: /etc/ansible/facts.d
recurse: true
state: directory
mode: 0755
owner: root
group: root
- name: Ansible local facts scripts present
ansible.builtin.copy:
src: "{{ script }}"
dest: "/etc/ansible/facts.d/{{ script }}"
mode: 0755
owner: root
group: root
validate: bash -n %s
loop:
- dpkg.fact
# - php_cfg.fact
# - php_mod.fact
# - php_pkg.fact
loop_control:
loop_var: script
register: php_local
- name: Re-read Ansible local facts
ansible.builtin.setup:
filter: ansible_local
when: php_local.changed
- name: Print Ansible local dpkg facts
ansible.builtin.debug:
var: ansible_local.dpkg
verbosity: 2
# - name: Print Ansible local PHP configuration facts
# ansible.builtin.debug:
# var: ansible_local.php_cfg
# verbosity: 2
# - name: Print Ansible local PHP module facts
# ansible.builtin.debug:
# var: ansible_local.php_mod
# verbosity: 2
# - name: Print Ansible local PHP packages facts
# ansible.builtin.debug:
# var: ansible_local.php_pkg
# verbosity: 2
tags:
- php
- php_local_facts
...
......@@ -2,11 +2,14 @@
- name: PHP
block:
- name: Local facts tasks
ansible.builtin.include_tasks: local_facts.yml
when: ansible_local.dpkg is not defined
tags:
- php_local_facts
- name: Include apt role local fact tasks if variables are not defined
ansible.builtin.include_role:
name: apt
tasks_from: local_facts.yml
when: >-
( ansible_local.dpkg.arch is not defined ) or
( ansible_local.gpg.version is not defined ) or
( ansible_local.bash.path is not defined )
- name: Sury apt repo config
ansible.builtin.include_tasks: apt.yml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment