Score:0

how to start nginx with ansible?

ie flag

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
Orphans avatar
cn flag
Have you checked the error-message? What does 'systemctl status nginx.service' say to you?
Nikita Kipriyanov avatar
za flag
Have you tried to start it manually to check if it could be started at all? For example, there could be an error in the configuration that prevents it from starting.
G20map avatar
ie flag
The error messsage said "inactive"
G20map avatar
ie flag
hi @NikitaKipriyanov when I logged in to the remote server. I am able to start it manually
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.