ansible-host: Publish ansible facts with nginx

This commit is contained in:
Timo Makinen 2020-08-29 13:43:21 +00:00
parent 88157dcc91
commit aac14db657
3 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,4 @@
location /facts {
autoindex on;
autoindex_format json;
}

View file

@ -1,3 +1,4 @@
--- ---
dependencies: dependencies:
- { role: epel-repo } - { role: epel-repo }
- { role: nginx/server }

View file

@ -30,12 +30,34 @@
state: link state: link
follow: false follow: false
- name: allow http server to access /srv/ansible
sefcontext:
path: /srv/ansible(/.*)?
setype: httpd_sys_content_t
- name: clone ansible repository - name: clone ansible repository
git: git:
dest: /srv/ansible dest: /srv/ansible
repo: https://git.foo.sh/ansible.git repo: https://git.foo.sh/ansible.git
update: false update: false
- name: link facts to nginx
file:
src: "/srv/ansible/facts"
dest: "/srv/web/{{ inventory_hostname }}/facts"
owner: root
group: "{{ ansible_wheel }}"
state: link
follow: false
- name: create nginx conf
copy:
src: nginx.conf
dest: /etc/nginx/conf.d/{{ inventory_hostname }}/ansible.conf
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
notify: restart nginx
- name: add custom .bashrc for root - name: add custom .bashrc for root
copy: copy:
dest: /root/.bashrc dest: /root/.bashrc