Skip to content
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

Fix for defining php variables for external role. #59

Merged
merged 3 commits into from
Mar 2, 2018

Conversation

whikloj
Copy link
Member

@whikloj whikloj commented Feb 15, 2018

Hopefully resolves Islandora/documentation#801

To define the variables for use in geerlingguy.php to use different versions of php_packages_extra this seems to work as his role includes these file names.

Perhaps the better way is to move this stuff to a /vars directory, but then I don't know how you set a variable in the inventory. Would we do that in the bootstrap.yml?

If there is a better way, please tell me. But this seems to work.

Interested parties

@seth-shaw-unlv @DigitLib @Natkeeran @MarcusBarnes @jonathangreen

@seth-shaw-unlv
Copy link
Contributor

I think this is the way to go.

We could do it in vars + bootstrap.yml, but since geerlingguy's role already provides the logic this seems the better solution.

@DigitLib
Copy link
Contributor

I agree with @seth-shaw-unlv this solution work fine and follow a geerlingguy role-php.

@seth-shaw-unlv
Copy link
Contributor

Oddly enough, I just discovered that this doesn't actually work. Ansible doesn't complain and a CentOS provision works, but when I spun up a Debian-based Islandora the apache php library wasn't there. I removed the Debian.yml file altogether and it actually worked then. To be honest, I'm not sure what is going on with the Debian php_packages_extra here.

@whikloj
Copy link
Member Author

whikloj commented Feb 20, 2018

Alright we can't hack geerlingguy's role, so we need to store these variables using a separate named variable file and include based on ansible_os_family at the start of the bootstrapping. I'm closing this.

@whikloj whikloj closed this Feb 20, 2018
@whikloj whikloj reopened this Feb 23, 2018
@whikloj
Copy link
Member Author

whikloj commented Feb 23, 2018

Can someone try this out. It seems to work, but then I thought the last attempt worked too 🤣

@DigitLib
Copy link
Contributor

DigitLib commented Feb 23, 2018

@whikloj for some reason geerligguy.php role didn't saw /var/RedHat.yml... (in my case)
Note: when I try Ubunty php-Debian.yml installed but php-RedHat.yml do not, but RedHat.yml is installed from /group_var/webserver dir

@Natkeeran
Copy link
Contributor

Natkeeran commented Feb 23, 2018

@whikloj

ERROR! the role 'geerlingguy.mysql' was not found in /home/nat/Desktop/clawtest2/claw-playbook/roles:/home/nat/Desktop/clawtest2/claw-playbook/roles/internal:/home/nat/Desktop/clawtest2/claw-playbook/roles/external:/home/nat/Desktop/clawtest2/claw-playbook

The error appears to have been in '/home/nat/Desktop/clawtest2/claw-playbook/database.yml': line 12, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
    - role: geerlingguy.mysql
      ^ here

May not be related this PR!

@whikloj
Copy link
Member Author

whikloj commented Feb 23, 2018

@DigitLib / @Natkeeran thanks...I'll try burning my setup down and pulling fresh to see what is happening.

@DigitLib
Copy link
Contributor

@whikloj this /var files seem to work today. I try it on Manjaro Linux, yesterday it won't on Fedora 26... Tried Ubuntu and CentOS it works on both. Without added gather_facts: false...

@whikloj
Copy link
Member Author

whikloj commented Feb 26, 2018

Thanks @DigitLib / @Natkeeran, I am getting an error but not until building the Grok dependencies. That was on Centos, I'll tear it down and try again with Ubuntu

@Natkeeran
Copy link
Contributor

@whikloj You can ignore the previous error I posted. I may not have installed the requirements! (was sleeping!).

This PR installs without error, but get the same php error related to missing library:
handle($request); $response->send(); $kernel->terminate($request, $response);

@whikloj
Copy link
Member Author

whikloj commented Mar 1, 2018

@Natkeeran @mjordan @DigitLib
I ran the playbook with -vvv logging and it appeared that it wasn't actually finding the php_extra_packages variable.

Moving it into the tasks and using include_vars: seems to work, and we can use this as a place to include overlapping variable definitions that need to be different based on OS version.

We could also use more specific files if necessary and the with_first_found argument to the include_vars command.

- name: Load a variable file based on the OS type, or a default if not found. Using free-form to specify the file.
  include_vars: "{{ item }}"
  with_first_found:
    - "{{ ansible_distribution }}.yml"
    - "{{ ansible_os_family }}.yml"
    - "default.yml"

@seth-shaw-unlv
Copy link
Contributor

Tested both Ubuntu and CentOS today. Both work for me now.

@Natkeeran Natkeeran merged commit ffc727a into Islandora-Devops:master Mar 2, 2018
@whikloj whikloj deleted the issue-801 branch September 24, 2021 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

claw-playbook - drupal error
4 participants