mirror of
https://github.com/Dannecron/netology-devops-ansible-lighthouse.git
synced 2025-12-25 13:32:34 +03:00
initial: create ansible role
This commit is contained in:
58
tasks/main.yml
Normal file
58
tasks/main.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
- name: lighthouse | install dependencies
|
||||
become: true
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- git
|
||||
- epel-release
|
||||
- name: lighthouse | create nginx site dir
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
mode: "755"
|
||||
owner: "{{ ansible_effective_user_id }}"
|
||||
group: "{{ ansible_effective_group_id }}"
|
||||
path: "/var/www"
|
||||
state: "directory"
|
||||
- name: lighthouse | clone repository
|
||||
ansible.builtin.git:
|
||||
repo: "{{ lighthouse_vcs }}"
|
||||
dest: "{{ lighthouse_location }}"
|
||||
version: "{{ lighthouse_vcs_version }}"
|
||||
- name: lighthouse | config selinux
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
cmd: chcon -Rt httpd_sys_content_t /var/www
|
||||
changed_when: false
|
||||
- name: lighthouse | install nginx
|
||||
become: true
|
||||
ansible.builtin.yum:
|
||||
name: nginx
|
||||
state: present
|
||||
- name: lighthouse | create nginx log dir
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
mode: "755"
|
||||
owner: "{{ ansible_effective_user_id }}"
|
||||
group: "{{ ansible_effective_group_id }}"
|
||||
path: "/var/log/nginx"
|
||||
state: "directory"
|
||||
- name: lighthouse | nginx template config
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "templates/nginx.conf.j2"
|
||||
dest: "/etc/nginx/nginx.conf"
|
||||
mode: "755"
|
||||
- name: lighthouse | nginx lighthouse config
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "templates/nginx.lighthouse.conf.j2"
|
||||
dest: "/etc/nginx/conf.d/lighthouse.conf"
|
||||
mode: "755"
|
||||
- name: lighthouse | start nginx service
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: nginx
|
||||
state: started
|
||||
- name: lighthouse | check service is accessible
|
||||
ansible.builtin.uri:
|
||||
url: http://localhost
|
||||
Reference in New Issue
Block a user