nginxinc / ansible-collection-nginx Goto Github PK
View Code? Open in Web Editor NEWAnsible collection for NGINX
License: Apache License 2.0
Ansible collection for NGINX
License: Apache License 2.0
Describe the bug
Currently only the release 0.2.0 is available on the galaxy
I get the following errors:
Your OS, Amazon is not supported by NGINX Open Source
fatal: [nginx]: FAILED! => {"changed": false, "msg": "Failure talking to yum: failure: repodata/repomd.xml from nginx: [Errno 256] No more mirrors to try.\nhttps://nginx.org/packages/mainline/rhel/2/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found"}
When installing on amazon linux.
Ami is ami-0528a5175983e7f28
(amzn2-ami-hvm-2.0*
).
A clear and concise description of what the bug is.
Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.
Add any other context about the problem here.
failed: [192.168.2.14] (item={u'config': {u'servers': [{u'core': {u'server_name': u'localhost', u'listen': [{u'port': 80}]}, u'sub_filter': {u'sub_filters': [{u'string': u'server_hostname', u'replacement': u'$hostname'}, {u'string': u'server_address', u'replacement': u'$server_addr:$server_port'}, {u'string': u'server_url', u'replacement': u'$request_uri'}, {u'string': u'remote_addr', u'replacement': u'$remote_addr:$remote_port'}, {u'string': u'server_date', u'replacement': u'$time_local'}, {u'string': u'client_browser', u'replacement': u'$http_user_agent'}, {u'string': u'request_id', u'replacement': u'$request_id'}, {u'string': u'nginx_version', u'replacement': u'$nginx_version'}, {u'string': u'document_root', u'replacement': u'$document_root'}, {u'string': u'proxied_for_ip', u'replacement': u'$http_x_forwarded_for'}], u'once': False}, u'log': {u'access': [{u'path': u'/var/log/nginx/access.log', u'format': u'main'}]}, u'locations': [{u'core': {u'index': u'index.html', u'root': u'/usr/share/nginx/html'}, u'location': u'/'}]}]}, u'template_file': u'http/default.conf.j2', u'deployment_location': u'/etc/nginx/conf.d/default.conf'}) => {"ansible_loop_var": "item", "changed": false, "item": {"config": {"servers": [{"core": {"listen": [{"port": 80}], "server_name": "localhost"}, "locations": [{"core": {"index": "index.html", "root": "/usr/share/nginx/html"}, "location": "/"}], "log": {"access": [{"format": "main", "path": "/var/log/nginx/access.log"}]}, "sub_filter": {"once": false, "sub_filters": [{"replacement": "$hostname", "string": "server_hostname"}, {"replacement": "$server_addr:$server_port", "string": "server_address"}, {"replacement": "$request_uri", "string": "server_url"}, {"replacement": "$remote_addr:$remote_port", "string": "remote_addr"}, {"replacement": "$time_local", "string": "server_date"}, {"replacement": "$http_user_agent", "string": "client_browser"}, {"replacement": "$request_id", "string": "request_id"}, {"replacement": "$nginx_version", "string": "nginx_version"}, {"replacement": "$document_root", "string": "document_root"}, {"replacement": "$http_x_forwarded_for", "string": "proxied_for_ip"}]}}]}, "deployment_location": "/etc/nginx/conf.d/default.conf", "template_file": "http/default.conf.j2"}, "msg": "TemplateAssertionError: no test named 'boolean'"}
Using debian buster get a message debian supported
"msg": "Your OS, Debian is supported by NGINX Open Source"
then an error and then stops not sure why it is checking for apline when it has alredy checked that it is debian?
TASK [nginxinc.nginx_core.nginx : Install dependencies] ********************************************************************************************************
fatal: [abc]: FAILED! => {"reason": "couldn't resolve module/action 'apk'. This often indicates a misspelling, missing collection, or incorrect module path.\n\nThe error appears to be in '/home/abc/ansibleplaybooks/ansible_collections/nginxinc/nginx_core/roles/nginx/tasks/prerequisites/install-dependencies.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: (Alpine Linux) Install dependencies\n ^ here\n"}.
At https://gist.github.com/kekru/c09dbab5e78bf76402966b13fa72b9d2
we see how TLS termination with backend servers depending on SNI would work. (not sure if theres another solution)
Is this possible with this collection?
Cheers
I am trying to execute the following playbook
---
- name: Basic setup
hosts: gates
collections:
- nginxinc.nginx_core
tasks:
- name: Install NGINX
include_role:
name: nginx
- name: Configure NGINX
include_role:
name: nginx_config
vars:
nginx_config_debug_output: true
nginx_config_cleanup: true
nginx_config_cleanup_paths:
- directory:
- /etc/nginx/conf.d
recurse: false
nginx_config_cleanup_files:
- /etc/nginx/conf.d/default.conf
nginx_config_main_template_enable: false
nginx_config_main_template:
template_file: nginx.conf.j2
conf_file_name: nginx.conf
conf_file_location: /etc/nginx/
user: nginx
worker_processes: auto
worker_rlimit_nofile: 1024
pid: /var/run/nginx.pid
error_log:
location: /var/log/nginx/error.log
level: warn
worker_connections: 1024
http_enable: true
access_log_format:
- name: upstream_info
format: |-
'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" "$http_user_agent" '
'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"'
access_log_location:
- name: upstream_info
location: /var/log/nginx/access.log
but the nginx.conf is getting the default values:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
I am running Ansible 4.1 and I have the 0.3.3 nginxinc.nginx_core collection
(cluster) joan@DESKTOP-OM8Q4NE:~/Abzu/cluster$ ansible --version
ansible [core 2.11.1]
config file = /home/joan/Abzu/cluster/ansible.cfg
configured module search path = ['/home/joan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/joan/.local/share/virtualenvs/cluster-DtMsh1G5/lib/python3.8/site-packages/ansible
ansible collection location = /home/joan/.ansible/collections:/usr/share/ansible/collections
executable location = /home/joan/.local/share/virtualenvs/cluster-DtMsh1G5/bin/ansible
python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
jinja version = 3.0.0
libyaml = True
I'm using a lot RHEL and Centos distribution, Now with Centos "stream" moving from v.8 distribution i'm interested in using Rocky Linux.
Extend "limitation" in use only whit distribution indicated in vars/main.yml also with Rocky linux distribution
change the following variable available from
nginx_distributions: [
'Alpine', 'Amazon', 'CentOS', 'Debian', 'FreeBSD', 'RedHat', 'SLES', 'Ubuntu',
'NetBSD', 'OpenBSD', 'DragonFlyBSD', 'HardenedBSD',
]
--- to ---
nginx_distributions: [
'Alpine', 'Amazon', 'CentOS', 'Debian', 'FreeBSD', 'RedHat', 'SLES', 'Ubuntu',
'NetBSD', 'OpenBSD', 'DragonFlyBSD', 'HardenedBSD', 'Rocky',
]
The preliminary test can be done correct and installation can be made.
##Add any other context or screenshots about the feature request here.
Tested proficiency with Rocky Linux 8.5 version using the following play:
---
- name: install and starts the Nginx web server on server one
hosts: one
pre_tasks:
- name: ensure http is not installed
yum:
name: httpd
state: absent
collections:
- nginxinc.nginx_core
roles:
- role: nginx
...
Some bug fixing are existing on the latest version of the role ansible-role-nginx-config
but not available to the people who installed it via the collection
Point the role ansible-role-nginx-config to the latest version
Installing the two roles inside the collection independently and not using the collection anymore
IT would work without problems, some refactoring needed but it defeats a bit the purpose of having a collection
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.