bennojoy / nginx Goto Github PK
View Code? Open in Web Editor NEWansible role nginx
ansible role nginx
Hi, how could I manage multiple nginx server instances with this role?
e.g.
server-nginx1
vars
...
server-nginx2
vars
...
server-nginxX
...
Regards.
I guess it's about Ansible 2 compatibility, here's the -vvvv
TASK [bennojoy.nginx : Install the nginx packages] *****************************
task path: /etc/ansible/roles/bennojoy.nginx/tasks/main.yml:11
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/packaging/os/yum.py
<pradvitop01> ESTABLISH SSH CONNECTION FOR USER: root
<pradvitop01> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/remy/.ansible/cp/ansible-ssh-%h-%p-%r pradvitop01 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1486381215.15-154476418521762 `" && echo ansible-tmp-1486381215.15-154476418521762="` echo ~/.ansible/tmp/ansible-tmp-1486381215.15-154476418521762 `" ) && sleep 0'"'"''
<pradvitop01> PUT /tmp/tmpey8r0w TO /root/.ansible/tmp/ansible-tmp-1486381215.15-154476418521762/yum.py
<pradvitop01> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/remy/.ansible/cp/ansible-ssh-%h-%p-%r '[pradvitop01]'
<pradvitop01> ESTABLISH SSH CONNECTION FOR USER: root
<pradvitop01> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/remy/.ansible/cp/ansible-ssh-%h-%p-%r pradvitop01 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1486381215.15-154476418521762/ /root/.ansible/tmp/ansible-tmp-1486381215.15-154476418521762/yum.py && sleep 0'"'"''
<pradvitop01> ESTABLISH SSH CONNECTION FOR USER: root
<pradvitop01> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/remy/.ansible/cp/ansible-ssh-%h-%p-%r -tt pradvitop01 '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1486381215.15-154476418521762/yum.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1486381215.15-154476418521762/" > /dev/null 2>&1 && sleep 0'"'"''
failed: [pradvitop01] (item=[u'redhat_pkg']) => {
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"conf_file": null,
"disable_gpg_check": false,
"disablerepo": null,
"enablerepo": null,
"exclude": null,
"install_repoquery": true,
"list": null,
"name": [
"redhat_pkg"
],
"state": "present",
"update_cache": false,
"validate_certs": true
},
"module_name": "yum"
},
"item": [
"redhat_pkg"
],
"msg": "No package matching 'redhat_pkg' found available, installed or updated",
"rc": 126,
"results": [
"No package matching 'redhat_pkg' found available, installed or updated"
]
}
Hi
Could you please add cache valid time to your apt tasks. Especially when developing playbooks it is very time consuming wait for slow repos updating.
Perhaps you could make the timeout it configurable if people need to force the update?
If you agree, I would also suggest you do this for your other ansible roles myslq etc.
Example is the proxy_set_header
that should allows us to adds multiple headers to requests. This fails due to the nature of YML — when specifying multiple keys the last entry simply overrides it.
Example in YML:
nginx_sites:
- server:
file_name: app
listen: 80
server_name: 'ubuntu1204'
location1:
name: '/'
proxy_pass: 'http://0.0.0.0:8080'
proxy_redirect: "off"
proxy_buffering: "off"
proxy_set_header: 'Host $host'
proxy_set_header: 'X-Real-IP $remote_addr'
proxy_set_header: 'X-Forwarded-For $proxy_add_x_forwarded_for'
Resulting configuration output:
location / {
proxy_buffering off;
proxy_pass http://0.0.0.0:8080;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
See also: http://wiki.nginx.org/HttpProxyModule
In your docs, check out the example under
-> the indentation around nginx_sites
is messed up
New-to-ansible users will get confused as the nginx_sites ... $url
bit actually lands in the nginx conf file (especially if the users are also of the copy-and-pasting and/or lazy-or-unwary or just-plain-tired sorts)
Currently site configuration files are created under /etc/nginx/conf.d
. Should these be created under /etc/nginx/sites-available
instead with a corresponding symlink in /etc/nginx/sites-enabled
?
How to DemoracyOs OnPremises
ansible-galaxy install -p ./roles -r ./requirements.yml
I see that in the tutorial from DemocracyOs OnPremises
requirements.yml
Définir le timezone : https://github.com/yatesr/ansible-timezone
Faut t'il vraiment doubler avec les dépôts de github ?
from github
From github, overriding the name and specifying a specific tag
Now, i don't know how i can configure Ansible : https://www.visionduweb.eu/wiki/index.php?title=Installer_DemocracyOS#Reprendre_sur_la_Machine_Virtuelle
TASK: [bennojoy.nginx | Copy the nginx configuration file] ********************
fatal: [xxx.xxx.xxx.xxx] => {'msg': "One or more undefined variables: 'None' has no attribute 'iteritems'", 'failed': True}
fatal: [xxx.xxx.xxx.xxx] => {'msg': "One or more undefined variables: 'None' has no attribute 'iteritems'", 'failed': True}
FATAL: all hosts have already failed -- aborting
Ubuntu 12.04
Can give more info, if it need.
There is not currently a way to define the "everything else" case to do a 301 redirect.
server {
listen 80 default_server;
server_name _;
return 301 http://example.com$request_uri;
}
fatal: [192.168.56.2]: FAILED! => {"failed": true, "msg": "ERROR! environment must be a dictionary, received env (<class 'ansible.parsing.yaml.objects.AnsibleUnicode'>)"}
Googling and quickly falling on this ticket:
ansible/ansible#11912
I assume that several package from @bennojoy gonna require some update if used with ansible2.0
Refer to the docs: http://nginx.org/en/docs/http/ngx_http_upstream_module.html
Use cases:
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.