(note: Some links go to internal Red Had Jenkins jobs and are not accessable to the general community at this point).
We want to be able to generate and publish the CLI guide to AWX documentation instead of controller docsite.
The current Jenkins job and supporting playbooks are controller-branded.
Also, the tool (awxcli) generates a complete sphinx-based html docsite (stand alone).
The AWX/Controller CLI guide depends on having an active AWX/Controller instance running to pull the details from.
The current code that generates the CLI guide creates HTML for a standalone docsite. We have the following options to create the guide for AWX:
Option 1. Integrate awxkit files and conf.py into AWX docsite generation.
Option 2 Generate RST and integrate into AWX docsite
Option 3 - Create Standalone docsite using existing resources with branding modifications.
NOTE would be beneficial to downstream docs if we can produce some interim output they can bring into their downstream toolchain. Today, downstream publishing supports asciidoc, but moving to DITA. TBD if .md will be supported in the future. Sphinx can generate .xml files in the docutils format so that might be an option to consider (sphinx-build -b xml source build
).
There are two steps here:
Can test this locally but how would the RTD docs generation instantiate a running AWX instance?? Possibly with GitHub actions?
Ideas below here have been rejected…
Since the existing code is branded and generates html for a standalone site, we cannot use it directly. Instead we could:
NOTE: We need to keep the existing generation working for the Controller CLI Guide so cannot break that rendering option.
The existing code creates a foo.doctree file, but docutils tools like xml2rst can't seem to convert this back to an .rst file (not to mention the tool is python2 based and requires some changes to run).
I've been experimenting with the sphinx extension, sphinx-contrib.autoprogram and the awxcli custom extenstion based on this. I can see they build up a docutils document structure within the code, but similarly cannot see how to get this to an RST file.
Seems sphinx directives produce .doctree files that also include the TOC for the whole site so can't use this directly, but perhaps the next step is to try and move some of the awxkit/cli stuff into the /docs/docsite folder and see how far I get.
The following are basic steps to create a standalone AWX CLI guide (not part of the AWX docsite). It uses existing resources and rebrands for AWX:
The static CLI rst files already exist in the AWX repo, so we could
Drafting out how a new awx_cli_docs workflow would go.
Run the awx image (with run_awx_devel action), which will call awx_devel_image action) to generate the awx devel images.
Run a new action - awx_cli_docs_generate
action with the following:
CONTROLLER_HOST=https://awx.example.org CONTROLLER_USERNAME=example CONTROLLER_PASSWORD=secret make clean html
CONTROLLER_HOST=https://awx.localhost:8043 CONTROLLER_USERNAME=admin CONTROLLER_PASSWORD=password make clean html
Where the details come from step 1 on where the awx instance is, password, etc. (seems from the .yaml that username is admin and password is password).
Append the tox.ini for docs to combine this HTML with the spinx-build
HTML.
You will need a running awx instance. You can either build awx_devel locally or get the image.
Notes on building locally:
If running in a VM, must have 16G memory to build UI etc
docker-compose is already part of the docker install
You can build the CLI locally if you have an AWX instance running.
Install requirements for awxkit -
pip install sphinx sphinxcontrib-autoprogram
pip install awxkit
(dunno how to run from source)
cd awxkit/awxkit/cli/docs/
CONTROLLER_HOST=https://localhost:8043 CONTROLLER_USERNAME=awx CONTROLLER_PASSWORD=awx CONTROLLER_VERIFY_SSL=f make clean html
Just samccann's scribble-notes on how she got it running locally…
If running in a VM, must have 16G memory to build UI etc
make docker-compose
In a separate terminal:
install requirements for awxkit -
pip install sphinx sphinxcontrib-autoprogram
pip install awxkit (dunno how to run from source)
cd awxkit/awxkit/cli/docs/
CONTROLLER_HOST=https://localhost:8043 CONTROLLER_USERNAME=awx CONTROLLER_PASSWORD=awx CONTROLLER_VERIFY_SSL=f make clean html
The preferred way to install the AWX CLI is through pip:
pip install "git+https://github.com/ansible/awx.git@$VERSION#egg=awxkit&subdirectory=awxkit"
…where $VERSION is the version of AWX you’re running. To see a list of all available releases, visit: https://github.com/ansible/awx/releases
sudo systmectl start docker
docker run hello-world (just to verify)
source ~/venvs/awx/bin/activate
make docker-compose
Going from doctrees to xml:
Create a small unpickle.py script:
import pickle
with open("install.doctree", "rb") as f:
result = pickle.load(f)
print(result)
then python unplickle.py > xx to see the unpickled XML generated during the sphinx docs build.
clone or fork https://github.com/docutils/docutils
follow readme - https://github.com/samccann/docutils/blob/master/sandbox/xml2rst/README
At this point - python3 xml3rst.py –help should work
Create VM and ssh to new VM
ip a s
ssh-copy-id user@ipofvm
ssh -L 8080:127.0.0.1:8000 user@ipofvm
ssh -l
helps us to open the browser in the local machine.Start the docker container . Fedora 40 comes with a preinstalled docker
sudo systemctl start docker
sudo systemctl status docker
Install sphinx sphinxcontrib-autoprogram
python3 -m pip install sphinx sphinxcontrib-autoprogram
python3 -m pip install awxkit
cd awxkit/awxkit/cli/docs
CONTROLLER_HOST=https://localhost:8043 CONTROLLER_USERNAME=awx CONTROLLER_PASSWORD=awx CONTROLLER_VERIFY_SSL=f make clean html
Install the http.server
module and activate the virtual environment
python3 -m http.server
python3 -m venv .venv
source .venv/bin/activate
Get the official awx_devel image from the ghcr repository
docker images
docker pull ghcr.io/ansible/awx_devel:devel
Go to the awx directory
cd awx
run the docker compose command
make docker-compose
Open the build html in the chosen port of the local browser.
localhost:8080/build/html
Create VM and ssh to new VM
ip a s
ssh-copy-id user@ipofvm
ssh user@ipofvm
Install the dependencies
Clone the awx repo
git clone https://github.com/ansible/awx.git
Go to the awx
dir cd awx
make docker-compose
Install dependencies
Export the environment variable
export CFLAGS="-Wno-error=incompatible-pointer-types"
Install dependecies
The docker engine on Fedora CoreOS does not support the “buildx” subcommand which is needed to build container images for multiple architectures. To solve this issue follow the following steps (in your local browser)
scp Downloads/docker-desktop-x86_64.rpm userid@ipofvm
~/.docker/cli-plugins/docker-buildx
directory
Build the doc with the make command
make docker-compose-build
We have the awxkit this along with sphinx-contrib creates the cli docs. What
Install desktop for fe
What is happening this
document the flow of the jenkins jobs.