1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00
awx/tools/docker-isolated
Ryan Petrello 84eacfc360
fix a few isolated dev issues
the main goal of this change is to make `make docker-isolated` work out
of the box

- specify the proper version for awx-expect --version
- update some deprecated playbook bits
- change the isolated container to privileged so bwrap will work
- fix awx-manage test_isolated_connection
- expedite the first isolated heartbeat so you don't have to wait 10m;
  this is accomplished by _not_ setting Instance.last_isolated_check to
  now() at insertion time (which causes the next check not to happen for
  10 minutes)
- fix a bug that caused isolated node execution to fail when bwrap was
  enabled

see: https://github.com/ansible/tower/issues/2150

This reverts commit 9863fe71dc.
2018-06-13 14:17:58 -04:00
..
awx-expect Mass rename from ansible_(awx|tower) -> (awx|tower) 2017-07-26 13:33:26 -04:00
Dockerfile fix a few isolated dev issues 2018-06-13 14:17:58 -04:00
README.md more tower -> awx for task execution and isolated tooling 2017-07-25 10:36:06 -04:00

Instructions on using an isolated node

The building of the isolated node is done in the make docker-compose-build target. Its image uses a different tag from the tools_awx container.

Given that the images are built, you can run the combined docker compose target. This uses the base docker-compose.yml with modifications found in docker-isolated-override.yml. You will still need to give COMPOSE_TAG with whatever your intended base branch is. For example:

make docker-isolated COMPOSE_TAG=devel

This will automatically exchange the keys in order for the tools_awx_1 container to access the tools_isolated_1 container over ssh. After that, it will bring up all the containers like the normal docker-compose workflow.

Running a job on the Isolated Node

Create a job template that runs normally. Add the id of the instance group named thepentagon to the JT's instance groups. To do this, POST the id (probably id=2) to /api/v2/job_templates/N/instance_groups/. After that, run the job template.

The models are automatically created when running the Makefile target, and they are structured as follows:

+-------+     +-------------+
| tower |<----+ thepentagon |
+-------+     +-------------+
    ^                ^
    |                |
    |                |
+---+---+      +-----+----+
| tower |      | isolated |
+-------+      +----------+

The controller for the group "thepentagon" and all hosts therein is determined by a ForeignKey within the instance group.

Run a playbook

In order to run an isolated job, associate the instance group thepentagon with a job template, inventory, or organization, then run a job that derives from that resource. You should be able to confirm success by inspecting the instance_group of the job.

Advanced Manual Testing

If you want to run a job manually inside of the isolated container with this tooling, you need a private data directory. Normal isolated job runs will clean up their private data directory, but you can temporarily disable this by disabling some parts of the cleanup_isolated.yml playbook.

Example location of a private data directory:

/tmp/ansible_awx_29_OM6Mnx/

The following command would run the playbook corresponding to that job.

awx-expect start /tmp/ansible_awx_29_OM6Mnx/

Other awx-expect commands include start, is-alive, and stop.