This commit is contained in:
2024-04-16 00:27:07 +03:00
parent f0ee952d8f
commit e68a1406ba
4 changed files with 10 additions and 45 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
[node] [node]
node1 ansible_host=172.17.33.191 nginx_user=www-data node1 ansible_host=172.17.35.153 nginx_user=www-data
node2 ansible_host=172.17.33.206 nginx_user=root node2 ansible_host=172.17.33.254 nginx_user=root
[all:vars] [all:vars]
ansible_user = cloudadmin ansible_user = cloudadmin
+3 -34
View File
@@ -1,40 +1,9 @@
--- ---
- name: Update packeges - name: Update packages
hosts: node hosts: node
become: yes become: yes
tasks: roles:
- name: Update all packages Ubuntu - role: ./tsm_labs
when: ansible_os_family == 'Debian'
apt:
update_cache: yes
upgrade: yes
- name: Update all packages CentOS
when: ansible_os_family == 'RedHat'
yum:
name: '*'
state: latest
- name: Install nginx 'Ubuntu'
when: ansible_os_family == 'Debian'
ansible.builtin.apt:
package:
- nginx
state: present
update_cache: yes
- name: Install nginx 'RedHat'
when: ansible_os_family == 'RedHat'
ansible.builtin.yum:
name:
- nginx
state: present
- name: Copy config nginx
ansible.builtin.template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
+4 -4
View File
@@ -1,12 +1,12 @@
--- ---
# handlers file for itt_labs # handlers file for itt_labs
- name: Enable nginx service - name: Enable nginx service
ansible.builtin.systemd_service: ansible.builtin.systemd:
name: "nginx.service" name: nginx.service
state: restarted state: restarted
enabled: true enabled: true
- name: Reload nginx service - name: Reload nginx service
ansible.builtin.systemd_service: ansible.builtin.systemd:
name: "nginx.service" name: nginx.service
state: restarted state: restarted
+1 -5
View File
@@ -1,8 +1,4 @@
--- ---
- name: Update packeges
hosts: node
become: yes
tasks:
- name: Update all packages Ubuntu - name: Update all packages Ubuntu
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
apt: apt:
@@ -36,7 +32,7 @@
dest: /etc/nginx/nginx.conf dest: /etc/nginx/nginx.conf
owner: root owner: root
group: root group: root
made: '0644' mode: '0644'
notify: Reload nginx service notify: Reload nginx service