|
| 1 | +# Frequently Asked Questions |
| 2 | + |
| 3 | +## Where did everything go? |
| 4 | + |
| 5 | +The project undertook some serious remodeling, but rest assured, your definitions will still work as they did in the previous version of `cloudera-deploy`. |
| 6 | + |
| 7 | +Okay, but where did everything go? Well... |
| 8 | + |
| 9 | +1. The `quickstart.sh` migrated to `ansible-navigator`. Both of these applications use a container based on `ansible-runner`, i.e. [`cldr-runner`](https://github.com/cloudera-labs/cldr-runner), to execute the playbooks, yet `ansible-navigator` is configuration-driven and better aligned with how AWX runs Ansible in containers. Also, `ansible-navigator` brings a nifty UI and the ease of use to handle different execution modes. |
| 10 | + |
| 11 | + We also migrated `cldr-runner` to use `ansible-builder`, but you can read more about that effort at the [`cldr-runner`](https://github.com/cloudera-labs/cldr-runner) project. |
| 12 | + |
| 13 | +1. The original `cloudera-deploy` playbooks moved into `cloudera.exe`. Starting with Ansible `2.11`, [collections can contain playbooks](https://docs.ansible.com/ansible/latest/collections_guide/collections_using_playbooks.html#using-a-playbook-from-a-collection). We call the playbooks using `import_playbook` like roles. |
| 14 | + |
| 15 | + PLEASE NOTE, if you are developing your own project playbooks, you must first set up your `cloudera-deploy` variables _before_ calling the playbooks by running the `cloudera.exe.init_deployment` role on `localhost`. |
| 16 | + |
| 17 | +1. The _run-levels_ still remain; you can still use `-t infra` for example. However, the playbooks themselves are more granular and overall set up and tear down processes are now separate playbooks. |
| 18 | + |
| 19 | + This change promotes composibility and reusability, and we are going to continue to break apart the functions and operations within `cloudera-deploy` and -- most importantly -- the collections that drive this application. We fully expect that you will want to adapt and create your own "deploy" application, one that caters to _your_ needs and operating parameters. Switching to a more granular, more modular approach is key to this objective. |
| 20 | + |
| 21 | +## How to I add _extra variables_ and tags to `ansible-navigator`? |
| 22 | + |
| 23 | +If you want to run a playbook with a given tag, e.g. `-t infra`, then simply add it as a parameter to the `ansible-navigator` commandline. For example, `ansible-navigator run playbook.yml -t infra`. |
| 24 | + |
| 25 | +Like tags, so you can pass _extra variables_ to `ansible-navigator` and the underlying Ansible command. For example, `ansible-navigator run playbook.yml -e @some_config.yml -e some_var=yes`. |
| 26 | + |
| 27 | +## How do I tell `ansible-navigator` where to find collections and roles? |
| 28 | + |
| 29 | +By default, `cloudera-deploy` expects to use the collections, roles, and libraries within the _execution environment_ container, that is `cldr-runner`. Make sure you do _not_ have `ANSIBLE_COLLECTIONS_PATH` or `ANSIBLE_ROLES_PATH` set or `ansible-navigator` will pick up these environment variables and pass them to the running container. The underlying `ansible` application, like `ansible-playbook` will then pick up these environment variables and attempt to use them if set! This behavior is great if you want to use host-based collections, e.g. local development, but you need to ensure that you update the `ansible-navigator.yml` configuration file to mount the host collection and/or role directories into the execution environment container. |
| 30 | + |
| 31 | +## `ansible-navigator` hangs when I run my playbook. What is going on? |
| 32 | + |
| 33 | +`ansible-navigator` does not handle user prompts when running in the `curses` UI, so actions in your playbook like: |
| 34 | + |
| 35 | +* Vault passwords |
| 36 | +* SSH passphrases |
| 37 | +* Debugger statements |
| 38 | + |
| 39 | +will not work out-of-the-box. You can enable `ansible-navigator` to run with prompts, but doing so will also disable the UI and instead run its operations using `stdout`. Try adding: |
| 40 | + |
| 41 | +```bash |
| 42 | +ansible-navigator run --enable-prompts ... |
| 43 | +``` |
| 44 | + |
| 45 | +to your execution. |
| 46 | + |
| 47 | +## How can I view a previous `ansible-navigator` run to debug an issue? |
| 48 | + |
| 49 | +Each example is configured to save execution runs in the project's `runs` directory. You can reload a run by using the `replay` command: |
| 50 | + |
| 51 | +```bash |
| 52 | +ansible-navigator replay runs/<playbook name>-<timestamp>.json |
| 53 | +``` |
| 54 | + |
| 55 | +Then you can use the UI to review the plays, tasks, and inventory for the previous run! |
| 56 | + |
| 57 | +## How can I enable the playbook debugger? |
| 58 | + |
| 59 | +The [playbook debugger](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_debugger.html) is enabled in `ansible-navigator` by setting the debugger and then enabling prompts. For example, |
| 60 | + |
| 61 | +```bash |
| 62 | +ANSIBLE_ENABLE_TASK_DEBUGGER=True ansible-navigator run --enable-prompts main.yml |
| 63 | +``` |
| 64 | + |
| 65 | +## How can I select just a single subnet using `subnet_filter`, say for a CDE definition? |
| 66 | + |
| 67 | +The various `filters`, like `subnet_filter`, `loadbalancer_subnets_filter`, etc., use [JMESPath](https://jmespath.org/) expressions against a list of subnet objects. Using expression like: |
| 68 | + |
| 69 | +```jmespath |
| 70 | +[?contains(subnetName,`pvt`)] | [:1] |
| 71 | +``` |
| 72 | + |
| 73 | +will limit the list of subnet objects to those with the term `pvt` and then select the first element of that reduced list. |
| 74 | + |
| 75 | +You can [test sample filters](https://play.jmespath.org/?u=45e4d839-15f9-4569-9490-20a2cbc0cc88) using this example on the JMESPath Playground (link goes to a preloaded playground): |
| 76 | + |
| 77 | +```json |
| 78 | +[ |
| 79 | + { |
| 80 | + "availabilityZone": "us-east-2c", |
| 81 | + "cidr": "10.10.64.0/19", |
| 82 | + "subnetId": "subnet-0123", |
| 83 | + "subnetName": "sbnt-pub-2" |
| 84 | + }, |
| 85 | + { |
| 86 | + "availabilityZone": "us-east-2a", |
| 87 | + "cidr": "10.10.0.0/19", |
| 88 | + "subnetId": "subnet-1234", |
| 89 | + "subnetName": "sbnt-pub-0" |
| 90 | + }, |
| 91 | + { |
| 92 | + "availabilityZone": "us-east-2c", |
| 93 | + "cidr": "10.10.160.0/19", |
| 94 | + "subnetId": "subnet-2345", |
| 95 | + "subnetName": "sbnt-pvt-2" |
| 96 | + }, |
| 97 | + { |
| 98 | + "availabilityZone": "us-east-2b", |
| 99 | + "cidr": "10.10.128.0/19", |
| 100 | + "subnetId": "subnet-3456", |
| 101 | + "subnetName": "sbnt-pvt-1" |
| 102 | + }, |
| 103 | + { |
| 104 | + "availabilityZone": "us-east-2b", |
| 105 | + "cidr": "10.10.32.0/19", |
| 106 | + "subnetId": "subnet-4567", |
| 107 | + "subnetName": "sbnt-pub-1" |
| 108 | + }, |
| 109 | + { |
| 110 | + "availabilityZone": "us-east-2a", |
| 111 | + "cidr": "10.10.96.0/19", |
| 112 | + "subnetId": "subnet-5678", |
| 113 | + "subnetName": "sbnt-pvt-0" |
| 114 | + } |
| 115 | +] |
| 116 | +``` |
0 commit comments