Commit 97460fd8 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: add ansible-galaxy extra args support

Closes #16
parent eacd4f40
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -249,7 +249,8 @@ This template can be configured with the following **environment variables**:
| `ANSIBLE_DEFAULT_EXTRA_ARGS`    | Optional default args to add to the ansible-playbook command line                    | **has to be defined if used**                  |
| `ANSIBLE_DEFAULT_ROLES_PATH`    | The default path where the roles should be installed                                 | `$CI_PROJECT_DIR/roles`                        |
| `ANSIBLE_FORCE_COLOR`           | Forces color on Ansible output                                                       | `true`                                         |
| `ANSIBLE_REQUIREMENTS_FILE`     | The file used to install roles with `ansible-galaxy install`                         | `requirements.yml`                             |
| `ANSIBLE_REQUIREMENTS_FILE`     | The file used to install roles with `ansible-galaxy role install`                    | `requirements.yml`                             |
| `ANSIBLE_GALAXY_EXTRA_ARGS`     | `ansible-galaxy role install` command [extra options](https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html#role-install) | _none_ |
| `ANSIBLE_SCRIPTS_DIR`           | The Ansible scripts base directory (relative to `$ANSIBLE_PROJECT_DIR`)              | `.`                                            |
| `ANSIBLE_HOST_KEY_CHECKING`     | Enable or disable the SSH host key checking                                          | `false` (disabled)                             |

+6 −1
Original line number Diff line number Diff line
@@ -63,10 +63,15 @@
    },
    {
      "name": "ANSIBLE_REQUIREMENTS_FILE",
      "description": "The file used to install roles with `ansible-galaxy install`",
      "description": "The file used to install roles with `ansible-galaxy role install`",
      "default": "requirements.yml",
      "advanced": true
    },
    {
      "name": "ANSIBLE_GALAXY_EXTRA_ARGS",
      "description": "`ansible-galaxy role install` command [extra options](https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html#role-install)",
      "advanced": true
    },
    {
      "name": "ANSIBLE_SCRIPTS_DIR",
      "description": "The Ansible scripts base directory (relative to `$ANSIBLE_PROJECT_DIR`)",
+2 −1
Original line number Diff line number Diff line
@@ -390,7 +390,8 @@ stages:
      log_info "--- \\e[32mrequiments\\e[0m file (\\e[33;1m${ANSIBLE_REQUIREMENTS_FILE}\\e[0m) found: running \\e[33;1mansible-galaxy install\\e[0m"
      export ANSIBLE_ROLES_PATH="$ANSIBLE_DEFAULT_ROLES_PATH:$ANSIBLE_ROLES_PATH"
      mkdir -p "$ANSIBLE_DEFAULT_ROLES_PATH"
      ansible-galaxy install -r "$ANSIBLE_REQUIREMENTS_FILE"
    # shellcheck disable=SC2086
      ansible-galaxy install -r "$ANSIBLE_REQUIREMENTS_FILE" $ANSIBLE_GALAXY_EXTRA_ARGS
    fi

    # extra var environment_type & environment_name