- name: create nginx group
group:
name: "{{ user }}"
state: present
gid: "{{ uid }}"
- name: create nginx user
user:
name: "{{ user }}"
group: "{{ user }}"
shell: /bin/false
system: yes
comment: Nginx Server
uid: "{{ uid }}"
home: /data/apps/nginx
tasks/install_deps.yml
- name: install nginx for ubuntu22.04
apt: name=libssl-dev,zlib1g-dev,libgd-dev,libgeoip-dev,libpcre3-dev
when: ansible_distribution_version=="22.04"
tasks/unarchive.yml
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /data/apps/nginx
state: directory
mode: '0755'
owner: "{{ user }}"
group: "{{ user }}"
- name: copy tar to remote nginx ubuntu22.04
unarchive:
src: nginx-1.22.1.tar.gz
dest: /data/apps/nginx/
owner: "{{ user }}"
group: "{{ user }}"
when: ansible_distribution_version=="22.04"
- name: link nginx
file:
src: /data/apps/nginx/nginx-1.22.1
dest: /usr/local/nginx
state: link