ansible.nginx-container
nginx-container
Adds an nginx service to your Ansible Container project. To install the service, follow these steps:
# Change to your Ansible Container project directory
$ cd myproject
# Install the nginx service
$ ansible-container install ansible.nginx-container
Requirements
You need Ansible Container.
An existing Ansible Container project. To create one, run:
# Create a new project folder $ mkdir myproject # Go to the new folder $ cd myproject # Initialize your project $ ansible-container init
Role Variables
STATIC_ROOT: /static
Path for static content to be served by nginx.PIDFILE_DIR: /run/nginx
Where nginx saves its current PID value.ASSET_PATHS: []
List of paths for static content to be copied to {{ STATIC_ROOT }}. Note: these paths need to be valid in the Ansible build container. If you are copying source files, mount the source directory in the build container using--with-volumes
.PROXY: no
If you're using this in a demo app where nginx needs to proxy a Django service, set this to 'yes'.PROXY_PASS: ""
Address of the backend server that nginx forwards requests to, e.g.,http://django:8080
.PROXY_LOCATION: ""
A string with an optional modifier and a pattern. Requests matching this pattern will be sent to the PROXY_PASS address. For example,~* /(api|static)
will forward requests that start with/api
or/static
.
Dependencies
None.
Contributing
To test your changes in this role, follow this workflow:
# Commit your changes
$ git commit -m "Your message"
# Push your changes
$ git push
# Navigate to the tests directory
$ cd tests
# Run a build that installs your role at the latest commit
$ ./build.sh
A few things to remember:
- You must
git push
your changes for the build to recognize them. - Update build.sh to link to your version of this role.
- If everything goes well, the container created from your latest commit will be running in the background.
- The running container will publish port 8000:8000, so if you go to http://localhost:8000 in your browser, you should see the default nginx page.
License
Apache v2
Author Information
Check the AUTHORS file for a list of contributors. Thank you all!