Skip to content

Workaround for issues with phpIPAM 1.7.0 and above #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ install-deps:

setup-phpipam: test-setup
docker-compose -f tests/docker/docker-compose.yml up -d
sh tests/docker/setup_database.sh
sh tests/docker/setup_phpipam.sh

FORCE:

Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,34 @@ The following dependencies have to be fulfiled by the Ansible controller.
* ipaddress
* phpypam>=1.0.0

## Compatibility notice

To ensure `phpipam-ansible-modules` work correctly with phpIPAM versions 1.7 and above, you need to modify the phpIPAM configuration to stringify API results. This is crucial because newer phpIPAM versions might return numerical values directly, which the Ansible modules might expect as strings.

Here's how to implement the workaround:

**1. Modify phpIPAM Configuration**

You need to set the `api_stringify_results` variable to `true` in your phpIPAM configuration. This change should be made in the `config.php` file, which is typically located in the phpIPAM installation directory (e.g., `/var/www/html/phpipam/config.php` or `/var/www/phpipam/config.php`).

Add or modify the following line in your `config.php` file:

```
<?php
/*
* phpIPAM config.php
*
* ... existing configuration ...
*/

// Required for Ansible modules with phpIPAM v1.7 and above
$api_stringify_results = true;

/*
* ... rest of your configuration ...
*/
?>
```
## Need help?

If you’ve found any issues in this release please head over to github and open a bug so we can take a look.
1 change: 0 additions & 1 deletion tests/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
phpipam:
image: "phpipam/phpipam-www:${PHPIPAM_VERSION:-v1.4.4}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ fi

if "${DOCKER_CMD}" ps | grep -q phpipam_test_webserver && ! eval "${MYSQL_PING}" ; then

if [[ $(echo "${PHPIPAM_VERSION:-v1.4.4}" | sed -E 's/v[0-9]?.([0-9]?).[0-9]?/\1/g') -ge 7 ]] ; then
info "Running version 1.7.0 or above, patching config"
${DOCKER_CMD} exec -t phpipam_test_webserver sh -c 'sed -i "s/api_stringify_results = false/api_stringify_results = true/g" /phpipam/config.dist.php'
fi

info -n "Waiting for database connection "
while ! eval "${MYSQL_PING}" ; do
info -n "."
Expand Down Expand Up @@ -44,8 +49,8 @@ if [[ $(mysqlshow -u root -prootpw -h 127.0.0.1 -P 3306 phpipam 2>/dev/null | wc

else

info "Detabase already initiated" && exit 0
info "Database already initiated" && exit 0

fi

info "Database initialisation $result"
info "Database initialization $result"
Loading