0

I installed nginx manually on my server, I started it to see if everything right then I "stopped" it.

Active: inactive (dead) since Thu 2022-12-15 02:58:37 EST; 7min ago

I am now using an ansible playbook to start it from my local computer but I get this error

fatal: [jo]: FAILED! => {"changed": false, "msg": "Unable to start service nginx: Failed to start nginx.service: Connection timed out\nSee system logs and 'systemctl status nginx.service' for details.\n"}

I don't understand, I am able to run nginx manually on the server but I can't do it remotely with ansible.

I created a user "john" who has sudo privilleges

john@testingserver:~$ cat /etc/passwd | grep john
john:x:1001:1001::/home/john:/bin/bash
john@testingserver:~$ groups john
john : john sudo

this is task file

---
- name: Install nginx
  apt:
    name: nginx
    state: present

- name: start nginx
  service:
    name: nginx
    state: started

This is my demo.yml file

- hosts: jo
  gather_facts: yes
  user: john
  become: yes
  become_user: john
  vars:
    - app_domain_name: demo.mydomain_name.com
  tasks:
    - ping:
  roles:
    - role: "deploy/django-demo-app/nginx"
      vars:
        gunicorn_port: 8000
G20map
  • 1
  • 1

0 Answers0